Hello everyone,
I am developing a wearable device using the nrf52832 chip, sdk11.0.0 and s132_nrf52_2.0.0_softdevice.
Because of battery capacity limitation, I have to minimize power consumption of device. So I turned off FPU before sd_app_evt_wait() being called, refer to [87] CPU: Unexpected wake from System ON Idle when using FPU.
My code to turn off FPU are below, and this code is from sdk17.0.0.
void pwr_mgmt_fpu_sleep_prepare(void)
{
uint32_t original_fpscr;
CRITICAL_REGION_ENTER();
original_fpscr = __get_FPSCR();
/*
* Clear FPU exceptions.
* Without this step, the FPU interrupt is marked as pending,
* preventing system from sleeping. Exceptions cleared:
* - IOC - Invalid Operation cumulative exception bit.
* - DZC - Division by Zero cumulative exception bit.
* - OFC - Overflow cumulative exception bit.
* - UFC - Underflow cumulative exception bit.
* - IXC - Inexact cumulative exception bit.
* - IDC - Input Denormal cumulative exception bit.
*/
__set_FPSCR(original_fpscr & ~0x9Fu);
__DMB();
NVIC_ClearPendingIRQ(FPU_IRQn);
CRITICAL_REGION_EXIT();
/*
* The last chance to indicate an error in FPU to the user
* as the FPSCR is now cleared
*
* This assert is related to previous FPU operations
* and not power management.
*
* Critical FPU exceptions signaled:
* - IOC - Invalid Operation cumulative exception bit.
* - DZC - Division by Zero cumulative exception bit.
* - OFC - Overflow cumulative exception bit.
*/
ASSERT((original_fpscr & 0x7) == 0);
}
After turning off FPU, an unexpected reset occurred when nRF53832 started advertisment.
I searched the forum and found a similar quertion posted by Valentin: Softdevice assertion failed after some time of advertisment without event.
The same thing is that the reset is related to the state of the FPU.
In Valentin`s question, device reset becouse of watchdog, but I don`t initialize watchdog in my program.
So, can anyone give me some advise to solve this problem? Thanks.