All of lore.kernel.org
 help / color / mirror / Atom feed
* UART baud rate to 3M within btattach
@ 2017-10-18 11:36 Libor Peltan
  2017-10-18 12:05 ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Libor Peltan @ 2017-10-18 11:36 UTC (permalink / raw)
  To: linux-bluetooth

Hi everyone,

my setup: Linux 4.14rc2, bluez 5.47. SoC + Qualcomm BT chip, connected via UART.
The default speed of the UART is 115200 bps, which is obviously slow, need 3M bps.

I already found out, how to do it: send a HCI command
0x01 0x48 0xFC 0x01 0x0E
In other words: OGF=0x3F, OCF=0x0048, plen=1, pdata=0xE
...and reset the UART after 300 millis with new speed.

This is possible via 'hcitool', but it breaks running instances of btattach...

I would like to make btattach to do it for me at startup. Is there a way to configure it?

It seems that hciattach had this possibility, but dunno if not already deprecated in bluez 5.47 and how to use it.

Thanks for any suggestions!!

Libor


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: UART baud rate to 3M within btattach
  2017-10-18 11:36 UART baud rate to 3M within btattach Libor Peltan
@ 2017-10-18 12:05 ` Marcel Holtmann
  2017-10-18 12:09   ` AW: " Libor Peltan
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2017-10-18 12:05 UTC (permalink / raw)
  To: Libor Peltan; +Cc: linux-bluetooth

Hi Libor,

> my setup: Linux 4.14rc2, bluez 5.47. SoC + Qualcomm BT chip, connected via UART.
> The default speed of the UART is 115200 bps, which is obviously slow, need 3M bps.
> 
> I already found out, how to do it: send a HCI command
> 0x01 0x48 0xFC 0x01 0x0E
> In other words: OGF=0x3F, OCF=0x0048, plen=1, pdata=0xE
> ...and reset the UART after 300 millis with new speed.
> 
> This is possible via 'hcitool', but it breaks running instances of btattach...
> 
> I would like to make btattach to do it for me at startup. Is there a way to configure it?
> 
> It seems that hciattach had this possibility, but dunno if not already deprecated in bluez 5.47 and how to use it.

so it depends on your hardware. Is the QCA or ATH hardware? Try btattach -P qca or btattach -P ath3k and see if it will change the baudrate and do the correct setup.

Regards

Marcel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* AW: UART baud rate to 3M within btattach
  2017-10-18 12:05 ` Marcel Holtmann
@ 2017-10-18 12:09   ` Libor Peltan
  2017-10-18 12:13     ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Libor Peltan @ 2017-10-18 12:09 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Thanks Marcel for your answer.

I call 'btattach -P h4', because ath3k and qca options would simply reply '=
protocol not supported'.

My point is how to send the HCI command inside, or before btattach launch.

Thanks :)

-----Urspr=FCngliche Nachricht-----
Von: Marcel Holtmann [mailto:marcel@holtmann.org]=20
Gesendet: Mittwoch, 18. Oktober 2017 14:05
An: Libor Peltan <lpeltan@insys-tec.de>
Cc: linux-bluetooth@vger.kernel.org
Betreff: Re: UART baud rate to 3M within btattach

Hi Libor,

> my setup: Linux 4.14rc2, bluez 5.47. SoC + Qualcomm BT chip, connected vi=
a UART.
> The default speed of the UART is 115200 bps, which is obviously slow, nee=
d 3M bps.
>=20
> I already found out, how to do it: send a HCI command
> 0x01 0x48 0xFC 0x01 0x0E
> In other words: OGF=3D0x3F, OCF=3D0x0048, plen=3D1, pdata=3D0xE ...and re=
set=20
> the UART after 300 millis with new speed.
>=20
> This is possible via 'hcitool', but it breaks running instances of btatta=
ch...
>=20
> I would like to make btattach to do it for me at startup. Is there a way =
to configure it?
>=20
> It seems that hciattach had this possibility, but dunno if not already de=
precated in bluez 5.47 and how to use it.

so it depends on your hardware. Is the QCA or ATH hardware? Try btattach -P=
 qca or btattach -P ath3k and see if it will change the baudrate and do the=
 correct setup.

Regards

Marcel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: UART baud rate to 3M within btattach
  2017-10-18 12:09   ` AW: " Libor Peltan
@ 2017-10-18 12:13     ` Marcel Holtmann
  2017-10-18 14:16       ` AW: " Libor Peltan
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2017-10-18 12:13 UTC (permalink / raw)
  To: Libor Peltan; +Cc: linux-bluetooth

Hi Libor,

> I call 'btattach -P h4', because ath3k and qca options would simply reply 'protocol not supported'.
> 
> My point is how to send the HCI command inside, or before btattach launch.

that is done by the different protocols drivers. Use a kernel that has support for ath3k or qca. Otherwise you can not do it. It designed that the kernel does the UART handling and the setup (including firmware loading etc.).

Regards

Marcel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* AW: UART baud rate to 3M within btattach
  2017-10-18 12:13     ` Marcel Holtmann
@ 2017-10-18 14:16       ` Libor Peltan
  2017-10-18 14:31         ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Libor Peltan @ 2017-10-18 14:16 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Thank you Marcel, your suggestion solved my issue:

I had to compile the kernel with CONFIG_BT_HCIUART_QCA.
I must also call following at the bootup:

btattach -S 3000000 -P qca
sleep 1
killall btattach
sleep 1
btattach -S 3000000 -P h4
bluetoothd

...otherwise bluetoothd doesn't work (=3Dfinds 0 adapters).
But I'm glad to have this workaround :)

Libor

-----Urspr=FCngliche Nachricht-----
Von: Marcel Holtmann [mailto:marcel@holtmann.org]=20
Gesendet: Mittwoch, 18. Oktober 2017 14:14
An: Libor Peltan <lpeltan@insys-tec.de>
Cc: linux-bluetooth@vger.kernel.org
Betreff: Re: UART baud rate to 3M within btattach

Hi Libor,

> I call 'btattach -P h4', because ath3k and qca options would simply reply=
 'protocol not supported'.
>=20
> My point is how to send the HCI command inside, or before btattach launch=
.

that is done by the different protocols drivers. Use a kernel that has supp=
ort for ath3k or qca. Otherwise you can not do it. It designed that the ker=
nel does the UART handling and the setup (including firmware loading etc.).

Regards

Marcel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: UART baud rate to 3M within btattach
  2017-10-18 14:16       ` AW: " Libor Peltan
@ 2017-10-18 14:31         ` Marcel Holtmann
  2017-10-19  7:54           ` AW: " Libor Peltan
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2017-10-18 14:31 UTC (permalink / raw)
  To: Libor Peltan; +Cc: linux-bluetooth

Hi Libor,

> Thank you Marcel, your suggestion solved my issue:
> 
> I had to compile the kernel with CONFIG_BT_HCIUART_QCA.
> I must also call following at the bootup:
> 
> btattach -S 3000000 -P qca
> sleep 1
> killall btattach
> sleep 1
> btattach -S 3000000 -P h4
> bluetoothd
> 
> ...otherwise bluetoothd doesn't work (=finds 0 adapters).
> But I'm glad to have this workaround :)

actually only one btattach command should be needed. If this doesn't work, we should fix hci_qca.c to support it. Since after loading the firmware and configuring the UART speed, the QCA protocol will automatically run H4. No need to kill btattach and restart it with a different protocol.

Can you share "btmon -w trace.log" traces?

Regards

Marcel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* AW: UART baud rate to 3M within btattach
  2017-10-18 14:31         ` Marcel Holtmann
@ 2017-10-19  7:54           ` Libor Peltan
  0 siblings, 0 replies; 7+ messages in thread
From: Libor Peltan @ 2017-10-19  7:54 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,
I tried to log what's going on both in case of my btattach-kill-btattach wo=
rkaround case, and in case i run only 'btattach -P qca' and bluetoothd is n=
ot working afterwards. You can find the logs at
http://stuff.krakonos.org/files/btmonSee.tar.bz2
I'm not really able to understand the output myself :(
Thank you for further comments,
Libor

-----Urspr=FCngliche Nachricht-----
Von: Marcel Holtmann [mailto:marcel@holtmann.org]=20
Gesendet: Mittwoch, 18. Oktober 2017 16:31
An: Libor Peltan <lpeltan@insys-tec.de>
Cc: linux-bluetooth@vger.kernel.org
Betreff: Re: UART baud rate to 3M within btattach

Hi Libor,

> Thank you Marcel, your suggestion solved my issue:
>=20
> I had to compile the kernel with CONFIG_BT_HCIUART_QCA.
> I must also call following at the bootup:
>=20
> btattach -S 3000000 -P qca
> sleep 1
> killall btattach
> sleep 1
> btattach -S 3000000 -P h4
> bluetoothd
>=20
> ...otherwise bluetoothd doesn't work (=3Dfinds 0 adapters).
> But I'm glad to have this workaround :)

actually only one btattach command should be needed. If this doesn't work, =
we should fix hci_qca.c to support it. Since after loading the firmware and=
 configuring the UART speed, the QCA protocol will automatically run H4. No=
 need to kill btattach and restart it with a different protocol.

Can you share "btmon -w trace.log" traces?

Regards

Marcel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-19  7:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18 11:36 UART baud rate to 3M within btattach Libor Peltan
2017-10-18 12:05 ` Marcel Holtmann
2017-10-18 12:09   ` AW: " Libor Peltan
2017-10-18 12:13     ` Marcel Holtmann
2017-10-18 14:16       ` AW: " Libor Peltan
2017-10-18 14:31         ` Marcel Holtmann
2017-10-19  7:54           ` AW: " Libor Peltan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.