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

Automatically shut down BLE communication (power_manage ();)?

Hi~ I used keil software environment for development. Apply Ble UART example code from nordic keil example. Example code down load to nRF51 Development Kit and run, program correct actuation in nRF51 Development Kit.

I used a smartphone and installation nRF ToolBox app from nordic. image description

Executive UART icon can receive wireless signals from the nRF51 Development Kit. Transfer string also correctly. image description

After power-on and never connector with smart phone, LED1 on nRF51 Development Kit is blink continue.

But never connector with any smart phone continue after a period of time (about several minutes), LED1 on nRF51 Development Kit is OFF, and can't Connect your smart phone. You must have the power-off and power-on again to re-connect with your smart phone.

I think it may automatically shut down is that right?

Trace example code can be found in the program has been executed power_manage() the while loop.

How can I change the example program without through a period of time after the phone can not connect.

  • I think you want to look at the advertisingInit() function. Many of the examples set the options advertising timeout to 30 seconds and/or 3 minutes. You can set the timeout to 0 to let it advertise forever until you connect.

  • Thank you a lot. I traced the nordic example code and found a the key parameter #define APP_ADV_TIMEOUT_IN_SECONDS 180 . That set the ble options advertising timeout 180 seconds. Change the parameter also can change the time required to enter timeout. But I want to let system never enter timeout, set parameter is 0 let It does not seem advertise forever. set parameter is 0 will very quick enter timeout state.

  • I have found the solution why the parameter APP_ADV_TIMEOUT_IN_SECONDS setting from 180 change to 0, the will very quick enter timeout state(or Error). Maybe can reference link devzone.nordicsemi.com/.../

    In Nordic Reference Example, if you want to change APP_ADV_TIMEOUT_IN_SECONDS =0. You must change flags in the advertisement data not to be BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE.

    image description

    In the picture, I changed the original setting (red box area). Changed the original setting and can set the timeout to 0 to let it advertise forever until phone connect.

Related