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

nrf_pwr_mgmt_run resets the device instead of going to sleep

Hello!

I have been working on bluetooth for some time and I just worked with connectable advertising until now. This time I am trying to add a beacon functionality too. The idea is to allow the device to keep changing between both Beacon and advertising. The problem is that after Beacon mode the device does not go to sleep. It restarts the device. But after advertising mode it works perfectly. This is the function I have been using all this time.

static void sleep_mode_enter(void)
{
// Prepare wakeup buttons.
uint32_t err_code = bsp_btn_ble_sleep_mode_prepare();
APP_ERROR_CHECK(err_code);

//Disable SoftDevice. It is required to be able to write to GPREGRET2 register (SoftDevice API blocks it).
//GPREGRET2 register holds the information about skipping CRC check on next boot.
err_code = nrf_sdh_disable_request();
APP_ERROR_CHECK(err_code);

nrf_pwr_mgmt_run();
}

Do you have any idea what is causing the reset?
Thank you very much.

Parents
  • Do you have any idea what is causing the reset?

     The device does not reset itself unless done in software or pin reset. I am guessing this is not a pin reset and must be a software reset. The best way to find out, it to compile your code with no optimizations and max debug symbols, start it to run in the debugger and put the breakpoints to all NVIC_SystemReset(); in your code. When you run the code, one of the NVIC_SystemReset will be hit and you will be able to see the call stack window to understand the context of this reset.

Reply
  • Do you have any idea what is causing the reset?

     The device does not reset itself unless done in software or pin reset. I am guessing this is not a pin reset and must be a software reset. The best way to find out, it to compile your code with no optimizations and max debug symbols, start it to run in the debugger and put the breakpoints to all NVIC_SystemReset(); in your code. When you run the code, one of the NVIC_SystemReset will be hit and you will be able to see the call stack window to understand the context of this reset.

Children
No Data
Related