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

Nordic UART Service Stops Advertising

Hi.

We are using the Nordic UART service.  Our project is based on the example project "ble_app_uart" from version 15.2 of the SDK.  I've found after about 3 minutes it stops advertising (the reason why I am unable to connect to it).  What would be the most likely cause?

If I connect to it before it stops advertising, it all works fine.  I can connect / disconnect again and again with no problems as long as I don't leave it sit advertising for too long.  When connecting to it I have been using the central example project (ble_app_uart_c) or an iPad with a custom application.  Both give the same behaviour.  As far as verifying if it is advertising or not goes, I'm using the nRF Connect Andriod App.

Thanks.

Parents
  • Hi. 

    If you take a closer look at the source code, you can see that this is the expected behavior of the ble_app_uart example.

    In the example (note that line numbers may differ due to changes you have made); 
    main.c, line:92

    #define APP_ADV_DURATION 18000 /**< The advertising duration (180 seconds) in units of 10 milliseconds. */

    This define is used in the advertising_init() function: 
    main.c, line:624

    init.config.ble_adv_fast_timeout = APP_ADV_DURATION;

    This define will stop the advertising if no connection has been initiated after 3 minutes (180 seconds), and the device will go to sleep. If you are using the nRF52-DK, you can wake up the device again by pressing one of the buttons. The DK will then wake up and advertise for the defined duration before going back to sleep again. 

    You will need to change this in order to advertise for more than 180 seconds. 
    Changing the APP_ADV_DURATION to 0 will make your device advertise indefinitely.

    Best regards, 
    Joakim 

Reply
  • Hi. 

    If you take a closer look at the source code, you can see that this is the expected behavior of the ble_app_uart example.

    In the example (note that line numbers may differ due to changes you have made); 
    main.c, line:92

    #define APP_ADV_DURATION 18000 /**< The advertising duration (180 seconds) in units of 10 milliseconds. */

    This define is used in the advertising_init() function: 
    main.c, line:624

    init.config.ble_adv_fast_timeout = APP_ADV_DURATION;

    This define will stop the advertising if no connection has been initiated after 3 minutes (180 seconds), and the device will go to sleep. If you are using the nRF52-DK, you can wake up the device again by pressing one of the buttons. The DK will then wake up and advertise for the defined duration before going back to sleep again. 

    You will need to change this in order to advertise for more than 180 seconds. 
    Changing the APP_ADV_DURATION to 0 will make your device advertise indefinitely.

    Best regards, 
    Joakim 

Children
Related