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

Uart example stops blinking after a while

I was testing ble_app_uart with my nRF51 DK and gcc compiler on Mac OX. Everything went fine. But after blinking for about 1 minute, the light that was supposed to be blinking remained on and stops blinking. This is a rather small problem but it concerns me whether or not there is some small issue in the code. Any idea?

  • Hi Oli, is this before connecting? if so then it might be that your device is going to sleep after the APP_ADV_TIMEOUT_IN_SECONDS interval? (used to set options.ble_adv_fast_timeout) If so then set this value to 0 and it will not sleep and will just keep advertising.

  • Hi Oli,

    If You can see the #defines there is a line "#define APP_ADV_TIMEOUT_IN_SECONDS 180" which is used in line 480 in the example code to set "options.ble_adv_fast_timeout". You have to set this parameter as "0" to disable the advt timeout as in this case after 180 secs the advt will stop.

    but in the example line 471 you can see you can see that the adv.flag parameter has been set as "advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;". In this mode you cannot set "options.ble_adv_fast_timeout" as 0 which is not permitted. As in any limited mode of advertising there has to be a time out value greater than 0.

    So you have set the advdata.flags parameter to a general advertising mode like "BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE" so that you can set the options.ble_adv_fast_timeout paramater to 0.

Related