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

BLE advertising data is populated when only app code is loaded, but is Empty when built together with BLE DFU Bootloader and Softdevice.

So, I am updating our advertisement data on a regular rate using a timer from freeRTOS on custom piece of software the is for the nRF52840. When only the app code is loaded (through Segger or using nrfjprog) the advertisement updates as it is supposed to. If a package is built that includes all the peices (BLE DFU Bootloader, SD, and App Code) the advertisement looks good at first, but then after 2 advertisements becomes empty. The device continues to broadcast, but the advert data just disappears. I am using the 2 buffer method to update advertising data that is found in many other posts. Why is the app code running differently by itself then it would when built into a package? Any help is apprecaited. Thanks.

  • Hello,

    What do you mean by: "after 2 advertisements becomes empty. The device continues to broadcast, but the advert data just disappears"?

    Have you tried to debug, to see if your application "crashes"? Maybe one of your APP_ERROR_CHECK(err_code) receives an err_code != 0, and your application reset? Could that explain the behavior that you see?

  • When debugging through Segger Studio, my application does not crash, and it keeps the advertising data (flags, name, and manufacturing data). The same happens when I program through Segger and then reset the device and disconnect the debugger. So, by itself, the app code appears to be running fine to the best of my knowledge. When I merge the app code with the DFU Bootlader and Soft Device and program it. The device start advertising correctly with all the data listed above, but after some time (usually 2 advertising intervals) the device continues to broadcast but with 0 length advert data. So, I able to see the device as it is still advertising the ESN and other required advertisement pieces, but the advertising data (flags, name, etc.) is now NULL with 0 length. The NRF app tells me it is empty when I look at the raw advertising data. I am going to try to get it debugging with the whole package and see what I see to help get you more details, but that is what I know at this point.

  • So, I found another interesting tidbit. I mistakenly was using softdevice version 6.0.0 in Segger Studio and 6.1.1 when building my Full package since I have upgraded to sdk ver 15.3. When I make the update to 6.1.1 in Segger Studio, the device is now clearing out the advert data the same way it is when I build the entire package. In other words, I get the same behavior for both methods of programming now. What would the difference be between s140 6.0.0 and s140 6.1.1 that would not let me dynamically update the advert data the same way?

  • Hello,

    The changes are listed in the s140_nrf52_6.1.1_release-notes.pdf:

    s140_nrf52_6.1.1_release-notes.pdf

    (which is included in the SDK).

    I suggest that you either study the changes here, and also follow the migration guide. 

    However, if your device doesn't advertise as expected, you should be able to find out why through debugging. Look at what your function calls return.

    I suspect that your application starts with an empty advertising set, and then you update the advertisements during runtime, is that correct?

    If so, then it sounds like you are hitting an error, and the application resets, causing the advertisements to go back to the default "empty" state. 

    Try to debug your application with the correct softdevice, and see if you can find out where it restarts.

  • The issue I had is my advertising data buffers were not declared statically. The linker must be treating these buffers slightly different between SD versions, but there is a note in the GAP header that states the advertising data must stay constant during advertisement. This was my issue.

Related