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

how to re-adverise without resetting the data in RAM on NRF51822

Hello, I am using SDK7.1.0 for NRF51822. In my subroutine, I would like to disconnect with the peer device, and re-advertise. But when after re-advertising, I found the data in RAM has been reset. I would like to know some questions as below:

  1. Is it supposed to reset the data in RAM when doing re-advertising?
  2. If re-advertising will cause reset RAM, is there any method which can do re-advertisement without reset data in RAM? Thanks Alex Chen
  • Starting and stopping advertising should not reset your RAM.

    Most likely, you are developing your code without the DEBUG compile flag set. This will cause your device to perform a full system reset on all assert/error conditions.

    Try setting a breakpoint in the assert handler, or recompile your app with the debug flag set.

  • Hi Jorgen,

    Thank you for your information. I will check it as you suggested. Actually, I use breakpoint to trace the routines. Just before performing re-advertising start, all the data in RAM is kept correctly, but after doing it, the data reset. Does advisting start() lead the system to check all the errors or warnings? If possible, I would like to know to get error reports from system.

  • The SoftDevices have strict timing requirements where certain operations (mostly interrupts I think) need to happen on a schedule.

    If you set a breakpoint while a SoftDevice is active, the CPU probably won't be running when the event from the SoftDevice needs to be handled. This results in a timeout and the SoftDevice will throw an error when you continue the CPU.

    The default operation for all errors -- if the DEBUG flag is NOT set -- is to call NVIC_SystemReset() which resets the device.

    Using your current build setup -- without the DEBUG flag set --, set a breakpoint on main(). I suspect that you will find when you continue from one of your breakpoints that the device will reset and you'll be back at main().

    Hope this helps!

    --- tom

Related