This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cannot restart advertising in Beacon example

Hey guys!

I face a problem that I have not been able to solve since several days...

I would like to send only one advertising frame every 4 seconds. I do not want to use connectable mode since I only need to send few values periodically, and I do not need to get any answers. So I have modified "ble beacon example", which appears to be the best starting point for my project.

I have set interval and timeout like this:

#define APP_CFG_NON_CONN_ADV_TIMEOUT    1
#define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(2000, UNIT_0_625_MS)

Normally I send a frame every 2 seconds, but with the timeout of 1sec, I only send 1 frame and the advertising stops.

I have set a timer every 4 seconds that launches the function "advertising_start()".

It works once. In the main loop, I launch once "avertising_init()" and when the timer reaches 4 seconds, it launches "advertising_start()". However, the next 4 seconds, my board seems to reset. I have enabled nRF_log, and when the timer uses again "advertising_start()" I can see:

APP_ERROR:ERROR:Fatal

Considering this post, I am stopping correctly the advertising. And with this one, it seems that I am restarting it correctly.

I need help to find what I am doing wrong... :D

Thanks for your help!

Parents
  • Oh, I get it. I've always used:

    							err_code = sd_ble_gap_adv_stop();
    						APP_ERROR_CHECK(err_code);
    

    And then:

    							err_code = sd_ble_gap_adv_start(&m_adv_params);
    						APP_ERROR_CHECK(err_code);
    

    So, far it's worked every time I have used it. Though if you are on a newer SDK, then the API's might have changed. But if they did, Nordic are pretty good at describing the API changes in the release notes.

    But from experience, I can tell you that the code executed to stop and start advertising is vastly more power hungry than a few beacons. So you need to be turning it off for quite a while to make it worth it on power consumption.

Reply
  • Oh, I get it. I've always used:

    							err_code = sd_ble_gap_adv_stop();
    						APP_ERROR_CHECK(err_code);
    

    And then:

    							err_code = sd_ble_gap_adv_start(&m_adv_params);
    						APP_ERROR_CHECK(err_code);
    

    So, far it's worked every time I have used it. Though if you are on a newer SDK, then the API's might have changed. But if they did, Nordic are pretty good at describing the API changes in the release notes.

    But from experience, I can tell you that the code executed to stop and start advertising is vastly more power hungry than a few beacons. So you need to be turning it off for quite a while to make it worth it on power consumption.

Children
No Data
Related