Quantcast
Viewing all articles
Browse latest Browse all 116964

Forum Post: Unable to restart advertising reliably

I have a BLE peripheral device based on the SimpleBLEPeripheral example code and BLE SDK v1.2.1. It advertises on startup, and on timeout goes to sleep. Pressing a button causes the device to start advertising again. The problem is that sometimes advertising doesn't start up again.

The device appears to get stuck in a state where it's waiting for something to happen. I've tracked it down to the point where it appears that OSAL task 0 (LL task) is waiting for something because it has set its power manager state to PWRMGR_HOLD (keeping the CC2541 from going to sleep).

I looked around to see if anyone had a similar problem, but I haven't been able to find anything. I am somewhat surprised because this problem happens fairly regularly on my system.

I reduced the project to something very minimal: 3 profiles (GAP, GATT, DevInfo), and an interrupt to detect the button press (sends an event to the simpleBLEPeripheral task which sets GAPROLE_ADVERT_ENABLED to turn on advertising)

I found a very hack-ish solution which is to set my task's power manager state to PWRMGR_HOLD when I turn on advertising. I put it back to PWRMGR_CONSERVE about 500 ms later. This seems to prevent the problem, but it's obviously not a good solution. Since this works, it really sounds to me like some type of race condition bug.


Viewing all articles
Browse latest Browse all 116964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>