hci interface stopped working after few hours #ble #hci #nrf52480 #uart
I'm facing issues regarding ble's hci interface.
I'm having nrf52840 module on which i run zephyr's hci_uart app for beacon scanning.
I have Bluez 5.50 installed on my custom board (imx6ull).
hci0 interface on my device is "UP RUNNING". So, i'm able to scan the beacons. (My application scans beacons after every 10 seconds).
Now, When i have put my device for over night testing, then i have observed that after few hours beacon scanning was stopped.
And i'm getting "Bluetooth: hci0 command 0x200b tx timeout" prints after every 5-10 seconds on the console, still the hci0 interface status is "UP RUNNING", but not able to scan the beacons.
Sometimes also getting the prints like "Bluetooth: hci0: Frame reassembly failed (-84)".
What could be the reason behind this ?
Thanks,
Mayank
Hi,
I’ve previously done testing with the HCI UART and USB sample apps (in older Zephyr versions) with an nRF52840 and linux PC and always found it to not work well. It would start fine, could scan for devices from bluetoothctl and then it just seemed to screw up every time with command timeouts. Never did much digging into why.
Thanks,
Jamie
> Hi All,
>
> I'm facing issues regarding ble's hci interface.
> I'm having nrf52840 module on which i run zephyr's hci_uart app for beacon scanning.
> I have Bluez 5.50 installed on my custom board (imx6ull).
>
> hci0 interface on my device is "UP RUNNING". So, i'm able to scan the beacons. (My application scans beacons after every 10 seconds).
>
> Now, When i have put my device for over night testing, then i have observed that after few hours beacon scanning was stopped.
> And i'm getting "Bluetooth: hci0 command 0x200b tx timeout" prints after every 5-10 seconds on the console, still the hci0 interface status is "UP RUNNING", but not able to scan the beacons.
>
> Sometimes also getting the prints like "Bluetooth: hci0: Frame reassembly failed (-84)".
>
> What could be the reason behind this ?
>
> Thanks,
> Mayank
Hi Mayank,
Are you using any host debugger firmware to convert to USB? or using 3v TTL connections to your custom board from nRF52840?
For those using USB_UART conversion, I am assuming you are using Segger JLink firmware on the host chip in the nRF52840 DK/dongle. Could you try using the MBED firmware on the host debugger chip?
Also, please create or refer me to GH issue, so that further discussions can be continued there.
Regards,
Vinayak
Sent: 05 March 2020 13:42
To: devel@...
Cc: devel@...
Subject: Re: [Zephyr-devel] hci interface stopped working after few hours #ble #hci #nrf52480 #uart
So does anyone have idea regarding this issue ?
I'm using zephyr (Version : 2.1.0) and Bluez (Version : 5.50).
Thanks,
Mayank
Hi Vinayak,
> Are you using any host debugger firmware to convert to USB? or using 3v TTL connections to your custom board from nRF52840?
When I tested it, it was using an nRF52840 PCA10059-like board without a 32KHz crystal (RC was selected from zephyr), I also tried on a BL654 DVK with the 32KHz connected and set in zephyr
> For those using USB_UART conversion, I am assuming you are using Segger JLink firmware on the host chip in the nRF52840 DK/dongle. Could you try using the MBED firmware on the host debugger chip?
When I was testing the UART one, I used an FTDI chip so this does not apply. I tested against a BT850 module, which also uses an FTDI with a non-zephyr based HCI module and that worked flawlessly
> Also, please create or refer me to GH issue, so that further discussions can be continued there.
I never created an issue. I haven’t tested in probably about a year now or so.
Thanks,
Jamie
Hi Jamie,
I think those questions were directed to Mayank, who is experiencing the issue now.
Thanks,
Carles
Sent: 05 March 2020 14:36
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>; mayank7117@...; devel@...
Cc: devel@...
Subject: Re: [Zephyr-devel] hci interface stopped working after few hours #ble #hci #nrf52480 #uart
Hi Vinayak,
> Are you using any host debugger firmware to convert to USB? or using 3v TTL connections to your custom board from nRF52840?
When I tested it, it was using an nRF52840 PCA10059-like board without a 32KHz crystal (RC was selected from zephyr), I also tried on a BL654 DVK with the 32KHz connected and set in zephyr
> For those using USB_UART conversion, I am assuming you are using Segger JLink firmware on the host chip in the nRF52840 DK/dongle. Could you try using the MBED firmware on the host debugger chip?
When I was testing the UART one, I used an FTDI chip so this does not apply. I tested against a BT850 module, which also uses an FTDI with a non-zephyr based HCI module and that worked flawlessly
> Also, please create or refer me to GH issue, so that further discussions can be continued there.
I never created an issue. I haven’t tested in probably about a year now or so.
Thanks,
Jamie
Hi, Both Mayank and Jamie,
I am interested in the way the HCI packets are transported to the Host Bluetooth stack.
In case of use of nRF DKs and Dongle, if using JLink debugger host firmware, you need to disable the Mass storage device (I don’t remember, it is something to do with 64-byte USB frames).
Hence, my request to try with MBED debugger host firmware which is a different UART to USB implementation.
In case using custom UART to USB, like FTDI, do you wire the CTS/RTS and using hardware flow control?
Same for the TTL connections, correct CTS/RTS and hardware flow control is essential.
The rationale being, observed HCI timeout and HCI framing errors indicate corrupted UART traffic.
Regards,
Vinayak
Sent: 05 March 2020 17:34
To: Cufi, Carles <Carles.Cufi@...>; Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>; mayank7117@...; devel@...
Cc: devel@...
Subject: Re: [Zephyr-devel] hci interface stopped working after few hours #ble #hci #nrf52480 #uart
Hi Carles,
I was assuming it was aimed at both of us, I’m not sure about what hardware they’re using. I’ll give it a try tomorrow with the hardware I have and see if it’s working with the latest branch of zephyr.
Thanks,
Jamie
Hi Vinayak
I gave it a try this morning with the latest master build of zephyr using the HCI_USB on an nrf52840_pca10059 dongle and I don’t get the errors/timeout issues as I save previously when I tested, however, GATT is unusable from bluetoothctl on linux (BlueZ 5.50). With the zephyr dongle, the device connects, seems to fail a connection parameter updates and disconnects – I am unable to list any details from the GATT server on the remote device (nothing comes through automatically and in the gatt menu, list-attributes seemingly does nothing). In comparison with a non-zephyr (cypress) based USB HCI dongle, it connects and instantly lists the GATT table, the connection parameter update still fails but even minutes later I am still connected to the remote device.
When I tested previously with a UART, it was with flow hardware control wired up to the FTDI chip. If zephyr was set to use it or not I cannot recall (it would have been the default for the HCI_UART example).
Thanks,
Jamie
Hi Jamie,
A btmon log would help identify the reason for disconnection.
> the connection parameter update still fails but even minutes later I am still connected to the remote device.
This is weird, the cypress dongle did not perform connection parameter update, update procedure on air only either succeeds or disconnects (unless it’s a connection parameter request procedure that is rejected by peer).
Regards,
Vinayak
Sent: 06 March 2020 08:43
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>; Cufi, Carles <Carles.Cufi@...>; mayank7117@...; devel@...
Subject: RE: [Zephyr-devel] hci interface stopped working after few hours #ble #hci #nrf52480 #uart
Hi Vinayak
I gave it a try this morning with the latest master build of zephyr using the HCI_USB on an nrf52840_pca10059 dongle and I don’t get the errors/timeout issues as I save previously when I tested, however, GATT is unusable from bluetoothctl on linux (BlueZ 5.50). With the zephyr dongle, the device connects, seems to fail a connection parameter updates and disconnects – I am unable to list any details from the GATT server on the remote device (nothing comes through automatically and in the gatt menu, list-attributes seemingly does nothing). In comparison with a non-zephyr (cypress) based USB HCI dongle, it connects and instantly lists the GATT table, the connection parameter update still fails but even minutes later I am still connected to the remote device.
When I tested previously with a UART, it was with flow hardware control wired up to the FTDI chip. If zephyr was set to use it or not I cannot recall (it would have been the default for the HCI_UART example).
Thanks,
Jamie
THIS MESSAGE, ANY ATTACHMENT(S), AND THE INFORMATION CONTAINED HEREIN MAY BE PROPRIETARY TO LAIRD CONNECTIVITY, INC. AND/OR ANOTHER PARTY, AND MAY FURTHER BE INTENDED TO BE KEPT CONFIDENTIAL. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE DELETE THE EMAIL AND ANY ATTACHMENTS, AND IMMEDIATELY NOTIFY THE SENDER BY RETURN EMAIL. THIS MESSAGE AND ITS CONTENTS ARE THE PROPERTY OF LAIRD CONNECTIVITY, INC. AND MAY NOT BE REPRODUCED OR USED WITHOUT THE EXPRESS WRITTEN CONSENT OF LAIRD CONNECTIVITY, INC.
Hi Vinayak
> A btmon log would help identify the reason for disconnection.
I have uploaded the 2 logs here: https://www.dropbox.com/s/d2yurf6nxee9wk0/btmon_logs.zip?dl=0
The Zephyr one has quite a lot at the beginning before I made the connection. Here is one of the disconnect events from the zephyr log file:
< HCI Command: Disconnect (0x01|0x0006) plen 3 #624 [hci0] 292.906310
Handle: 0
Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4 #625 [hci0] 292.907421
Disconnect (0x01|0x0006) ncmd 1
Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4 #626 [hci0] 292.923423
Status: Success (0x00)
Handle: 0
Reason: Connection Terminated By Local Host (0x16)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0002} [hci0] 292.923459
LE Address: DC:59:20:76:11:5C (Static)
Reason: Connection terminated by local host (0x02)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 292.923459
LE Address: DC:59:20:76:11:5C (Static)
Reason: Connection terminated by local host (0x02)
> > the connection parameter update still fails but even minutes later I am still connected to the remote device.
>
> This is weird, the cypress dongle did not perform connection parameter update, update procedure on air only either succeeds or disconnects (unless it’s a connection parameter request procedure that is rejected by peer).
Yes, that is what it is, apologies:
> ACL Data RX: Handle 0 flags 0x02 dlen 16 #179 [hci0] 69.454378
LE L2CAP: Connection Parameter Update Request (0x12) ident 2 len 8
Min interval: 6
Max interval: 12
Slave latency: 0
Timeout multiplier: 400
< ACL Data TX: Handle 0 flags 0x00 dlen 10 #180 [hci0] 69.454425
LE L2CAP: Connection Parameter Update Response (0x13) ident 2 len 2
Result: Connection Parameters rejected (0x0001)
Thanks,
Jamie
Hi Jamie,
All the disconnects are Host Bluetooth stack initiated. I will need some help from BlueZ guys to throw some light here.
Regards,
Vinayak
Sent: 06 March 2020 09:04
To: Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...>; Cufi, Carles <Carles.Cufi@...>; mayank7117@...; devel@...
Subject: RE: [Zephyr-devel] hci interface stopped working after few hours #ble #hci #nrf52480 #uart
Hi Vinayak
> A btmon log would help identify the reason for disconnection.
I have uploaded the 2 logs here: https://www.dropbox.com/s/d2yurf6nxee9wk0/btmon_logs.zip?dl=0
The Zephyr one has quite a lot at the beginning before I made the connection. Here is one of the disconnect events from the zephyr log file:
< HCI Command: Disconnect (0x01|0x0006) plen 3 #624 [hci0] 292.906310
Handle: 0
Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4 #625 [hci0] 292.907421
Disconnect (0x01|0x0006) ncmd 1
Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4 #626 [hci0] 292.923423
Status: Success (0x00)
Handle: 0
Reason: Connection Terminated By Local Host (0x16)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0002} [hci0] 292.923459
LE Address: DC:59:20:76:11:5C (Static)
Reason: Connection terminated by local host (0x02)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 292.923459
LE Address: DC:59:20:76:11:5C (Static)
Reason: Connection terminated by local host (0x02)
> > the connection parameter update still fails but even minutes later I am still connected to the remote device.
>
> This is weird, the cypress dongle did not perform connection parameter update, update procedure on air only either succeeds or disconnects (unless it’s a connection parameter request procedure that is rejected by peer).
Yes, that is what it is, apologies:
> ACL Data RX: Handle 0 flags 0x02 dlen 16 #179 [hci0] 69.454378
LE L2CAP: Connection Parameter Update Request (0x12) ident 2 len 8
Min interval: 6
Max interval: 12
Slave latency: 0
Timeout multiplier: 400
< ACL Data TX: Handle 0 flags 0x00 dlen 10 #180 [hci0] 69.454425
LE L2CAP: Connection Parameter Update Response (0x13) ident 2 len 2
Result: Connection Parameters rejected (0x0001)
Thanks,
Jamie
THIS MESSAGE, ANY ATTACHMENT(S), AND THE INFORMATION CONTAINED HEREIN MAY BE PROPRIETARY TO LAIRD CONNECTIVITY, INC. AND/OR ANOTHER PARTY, AND MAY FURTHER BE INTENDED TO BE KEPT CONFIDENTIAL. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE DELETE THE EMAIL AND ANY ATTACHMENTS, AND IMMEDIATELY NOTIFY THE SENDER BY RETURN EMAIL. THIS MESSAGE AND ITS CONTENTS ARE THE PROPERTY OF LAIRD CONNECTIVITY, INC. AND MAY NOT BE REPRODUCED OR USED WITHOUT THE EXPRESS WRITTEN CONSENT OF LAIRD CONNECTIVITY, INC.
Here i'm facing the issue even after using the full UART (Tx, Rx, RTS, CTS).
These 4 pins are connected & configured from both (i.MX6UL & nrf52840_pca10056).
Note : nrf52840 chip is flashed with HCI_UART sample app of zephyr. In that i have configured 4 pins and make HWFC enable from nrf5.conf file.
Ans still i'm not facing this issue continuously. Lets say i'm keeping beacon scanning on for 4-5 hours then its working fine. It crashes when i keep it running for 2-3 days.
Thanks,
Mayank
Ok,
Please create a GH issue and mentioned as much details as possible to help me reproduce the issue.
- Vinayak
Sent: 06 March 2020 11:24
To: devel@...
Cc: devel@...
Subject: Re: [Zephyr-devel] hci interface stopped working after few hours #ble #hci #nrf52480 #uart
Hi All,
Here i'm facing the issue even after using the full UART (Tx, Rx, RTS, CTS).
These 4 pins are connected & configured from both (i.MX6UL & nrf52840_pca10056).
Note : nrf52840 chip is flashed with HCI_UART sample app of zephyr. In that i have configured 4 pins and make HWFC enable from nrf5.conf file.
Ans still i'm not facing this issue continuously. Lets say i'm keeping beacon scanning on for 4-5 hours then its working fine. It crashes when i keep it running for 2-3 days.
Thanks,
Mayank
Hi Mayank,
When you create the GitHub issue please be specific about the exact layout of the setup you have.
It is not fully clear to me if you are connecting the nrf52840_pca10056 to the i.MX6UL via the PCA10056’s USB connector (i.e. using the PCA’s on-board debugger) or directly via lines to the UART from the i.MX’s pins to the nRF52840’s pins without any circuitry.
Thanks,
Carles
Sent: 06 March 2020 11:24
To: devel@...
Cc: devel@...
Subject: Re: [Zephyr-devel] hci interface stopped working after few hours #ble #hci #nrf52480 #uart
Hi All,
Here i'm facing the issue even after using the full UART (Tx, Rx, RTS, CTS).
These 4 pins are connected & configured from both (i.MX6UL & nrf52840_pca10056).
Note : nrf52840 chip is flashed with HCI_UART sample app of zephyr. In that i have configured 4 pins and make HWFC enable from nrf5.conf file.
Ans still i'm not facing this issue continuously. Lets say i'm keeping beacon scanning on for 4-5 hours then its working fine. It crashes when i keep it running for 2-3 days.
Thanks,
Mayank
Thank you for the support.
I have created the GH issue for the same https://github.com/zephyrproject-rtos/zephyr/issues/23319
Thanks,
Mayank