STM32L4 in Stop2 mode (Debug vs Release)
Good morning,
I have an application based on the STM32L475 device that is running in many devices since many years ago. We have observed that, sometimes, some of the devices are resetted --> Here you have the main specs of my device:
- Device is working in Stop2 mode
- It's is waking up every 31.25ms because of RTC interrupt, in order to do all the tasks. And then it goes back to stop2 mode
- Device has a watchdog implemented (1.5")
We have observed that some devices are automatically reseted sometimes: some devices are reseted many times par day, some devices are reseted a few times par day, or some devices are never reseted.
In order to allow us look for this reset reason, we have set device in debug mode, but surprisingly, in debug mode device is never stopped or reseted. So, we can not find the reset reason.
The main differences between debug and release mode are:
- Debug mode:
- Watchdog is obviously not working
- HAL_DBGMCU_EnableDBGStopMode function is called once before entering into main loop
All the other code is the same. And in the main loop we have this:
int main(void)
{
/* Clear reset flags in any cases */
__HAL_RCC_CLEAR_RESET_FLAGS();
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
//Variables initialization
Var_Par_Init();
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI);
//Only in debug mode
#ifdef EN_DEBUG
HAL_DBGMCU_EnableDBGStopMode();
#endif
while (1)
{
Tasks();
if(Equip_STOP_Mode()==SI) //No task is running so we can go to stop2 mode
{
//Enter into Stop2 mode
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
//When exiting Stop2 mode, clock is re-setup
SYSCLKConfig_STOP();
}
}
}So, which is the difference between Debug and Release mode in this case? Any idea how to find the reason of these resets?
