-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no more HCI events after a few times (around 6) disconnect and connection #654
Comments
Hi there. I understand that you are using an u-blox GPS module (they also produce Bluetooth and Cellular modules). Please disable ENABLE_LOG_DEBUG for logs to reduce clutter. So, from the log, it looks like data is sent all the time, which would indicate that there might be a problem on the receiving side. Could you try a different remote device and/or try to get the HCI Snoop logs from this device. However, you explain that you don't get any events on the Pico which would indicate a local problem. In that case, please check if you get an event when you turn off the remote device's Bluetooth, as this needs to generate an HCI Disconnect event. You can also try to use Polling mode instead of FreeRTOS. Finally, if it really is an issue with the CYW43xx, it would help to have a way to reproduce this. The GATT Counter or GATT Streamer might be a good option for that. |
Currently I am guessing a local problem as not even a disconnect is received anymore, it just 'stops'. As for the data, it is correct that all data is received untill it just stops... I did mention uBlox because that is what I am reading over serial port that is send over NMEA. The reason I am using a PICO is because I am already receiving and sending NMEA packages that contain traffic information send to a Electronic Flight Bag. It's good info for me that there is nothing suspicious in the log, I was not 100% sure of that yet. I will come back with further information or a way to reproduce.. |
hell @mringwal, I have created a repo demonstrating the issue, it contains a uf2 that can be put on a RP2040 PICO_W https://github.com/rvt/bluetoothtest/releases/tag/0.0.1 I did notice it takes a bit more work to get it into the situatoi, so like 12..16 connections/disconnections. The repo contains a readme on how to compile and a patch file as it needs v1.6.2 of the bluetooth stack that is not compatible with the PICO SDK 2.1.0 and it contains the patch for this issue: raspberrypi/pico-sdk#2101 in short to replicate:
If you have a terminal connected via OpenOCD where uart is connect to pin 16/17 you will also see hci output. The code of the bluetooth can be found here: https://github.com/rvt/bluetoothtest/blob/main/src/lib/bluetooth/ace/bluetooth.cpp The code looks a little bit chaotic, but that's because it's part of a larger codebase, this is just a stripped down version to bare minimum. The full code can be found here if you are curious : https://github.com/rvt/openace UPDATE: |
Thanks for preparing the test. Just to confirm: your Pico app mainly provides a GATT Service and you use Notifications to send data to the mobile phone. If you repeat { connect, send some data for some time, disconnect } often enough, it stops working, correct? Oh.. just reading you got it stable. To send notifications, you can send (att_event_mtu_exchange_complete_get_mtu() - 3). Could you verify that this works with either configuration? |
Correct Not even when I do att_event_mtu_exchange_complete_get_mtu() - 128. The MTU I am receiving was 512, which might be to large for the PICO with the CYW43? based on the above configuration. When i change the configuration to this: from:
to:
Then I can keep connecting and disconnecting just fine. MTU will be set to This is based on pico-sdk develop with bluekitchen v1.6.2 and the small patch to add Hope that helps. |
It's not clear what's going on. Please comment out HCI_DUMP_STDOUT_MAX_SIZE_ACL as well as ENABLE_LOG_DEBUG and get a new file that shows contains the hang. No need to shorten it, it's best if boot up is included. Even with Date Length Extension, the max packet is 251 bytes, which results in a max ATT MTU of 248 resp. a usable payload for a ATT Notification of 244. BTstack will try to negotiate for ATT MTU of 248 in the best case, so it's irritating that you would get 512 from att_event_mtu_exchange_complete_get_mtu(). I'd like to check this part in the new log. |
Attached new log: newlog.pklg.gz for completeness: PICO-SDK 2.1.0 / bluekitchen v1.6.2 Added a log entry for the MTU exchange and shows on line 325 Line 1179 shows I also did a quick test on I will also create a full log with streaming later this week for this example to see if I can trigger the issue with the default code. Just need to get the streaming to work as non of my tests applications seems to read the stream and I am not beable to trigger the issue I was seeing.. for completeness: PICO-SDK 2.1.0 / bluekitchen v1.6.2
|
Describe the bug
I have been using
sm_pairing_peripheral.c
as my 'template' and use it to steam NMEA data from a ublox over BLE. Pairing and bonding works fine aswell as storing this on flash.I am using this to steams data from an ublox (NMEA) to BLE, so it's a continues stream of NMEA data using notifications.
However, if I disconnect my device and reconnect a few times then after around 6 disconnects and re-connections the bluetooth stack stops responding and no more HCI events are received. No new connections are possible, no authentication is received and the log stays silent. Sometimes the stream might start for a second, then just stops. No disconnect events like
ATT_EVENT_DISCONNECTED
are received.Other tasks the PICO is running keep running just fine for example reading serial data from a ublox etc, SPI interfaces and the WIFI web interface that the device is running.
From the wireshark I cannot see anything that stands out, but I am not well versed on bluetooth, or wireshark so I am not sure what to look at yet.
To Reproduce
Not sure yet what example I can use or what to use on the receiving device to reproduce. First I would like to get a feel of what os going on, and if others have seen this.
Expected behavior
I expect that I can always disconnect and reconnect any number of times.
HCI Packet Logs
See attached gz file.
Environment: (please complete the following information):
out.pklg.gz
Configuration:
The text was updated successfully, but these errors were encountered: