Hello,

I'm working on a firmware for the Pinetime, a smartwatch based on the NRF52832. The code is written in C/C++ and uses FreeRTOS. I've recently switched from the Nordic Softdevice to NimBLE as BLE stack. I used the freertos port from the 'porting' folder of the source code of nimble.

I did many test using my PC on Linux : it can connect and communicate with the NRF52 without issue. However, things are not that easy when I try to connect using Android phone (I tried with a Huawei Psomething and my old Nexus5) : the connection fails most of the time.

I did a lot of debugging, logging, sniffing,.. and I still cannot understand why it's not working as expected. Here are some of my observations:

- When Android successfully connects, I receive the following GAP events : BLE_GAP_EVENT_CONNECT and then BLE_GAP_EVENT_CONN_UPDATE 2 times. The first update sets the connection interval to 6, the second one to 40. - When it fails, I receive only the BLE_GAP_EVENT_CONNECT event and the 1st BLE_GAP_EVENT_CONN_UPDATE. - Using the sniffer, I noticed that the last packet is a read request from the phone. It looks like the NRF52 never respond to this last read. - It fails in the discovery steps (when the android phone discover all the services, characteristics and attributes) but not always at the same place. - I noticed that the tasks (ll task and host task are not in deadlock BUT it looks like the radio ISR (ble_phy_isr() in ble_phy.c) is not called anymore. - When I build the very same code in DEBUG (-Og instead of -O3), it works perfectly!

You'll find in attachements 2 captures I did with Wireshark and the NRF Sniffer (running on a NRF52-DK), one failed and one successful attempt to connect.

I'm running out of idea to debug this further. Is there a configuration issue (there are so many parameters in syscfg.h)? What could I try? Where should I search ? Do you need more info to understand the issue?

Could you help me fix this issue?

Thanks,

JF

Reply via email to