This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf51 does not respond to bluetooth message

I am using nrf51 running as a peripheral and an iphone app as central. It works OK when I first use the iphone app to connect to nrf51. Then I quit the iphone app and let the nrf51 run in an idle mode with ble.waitForEvent(); If I restart the iphone app within a short time period, e.g., 1min, it can connect to nrf51 and work correctly with it. However if I wait longer time, e.g., 5-10mins, to restart the iphone app and connect to the nrf51, it can only discover the nrft1 advertising. The nrf51 does not respond to any message sent from the iphone App.

It seems that waiting in a idle mode with ble.waitForEvent() works only for a rather short period of time. The system would not function properly if there is no central device connect to it in a while. What could be the problem? Thanks!

  • Do you have any RF logs (e.g. from Nordic BLE sniffer or similar) which would support your hypothesis that "nRF51 does not respond to any message sent from the iphone App"?

  • Thanks for the suggestion. I will buy a dongle or 51 DK to run the sniffer. The symptom here is that after a long wait, the iphone App is still able to discover the nRF51 BLE device as peripheral. So there is advertising RF activity by the nRF51. But the nRF51 will not respond to BLE write from iphone app. I have the following programming structure. The activeloop seems to work fine. But if the program run in the idle loop for some time, I cannot use BLE message from iphone App to switch it back to the active loop. If the program run in the idle loop for a short time period. I can use BLE message from Iphone to switch it back to the active loop. main{ while{ if(activeloop){ // active loop operation performactivefunction(); }else{ // idle power saving loop ble.waitForEvent(); } }

    }

  • Hard to say from that little snippet (I assume you even don't use nRF5 SDK directly, is it mbed SDK or something else?). Btw. I suggest nRF51 DK as it seems to me little bit more stable with Nordic Sniffer FW and also more flexible (it typically needs to be in almost ideal position between 2 communicating peers and having DK on USB cable works better for me then Dongle plugged into the PC).

  • The iPhone will not disconnect straight away even though you close the app. So maybe after a short while you are still connected when you open the app, but after a while you are disconnected, and will have to connect again.

  • Yes. I am using the mbed for redbear BLEnano which uses nrf51. Is there any stability issue with using mbed? What I did is to completely quit the iphone App and wait for some time, then start the app again to discover and connect to the nrf51. If the wait time is short, the app works with nrf 51 correctly after the re-connection. If the wait time is long, nrf51 would not respond to ble messages from the app.

Related