Question regarding hardware state and debug in stop mode
Hi,
I am currently writing a program for the part STM32L031F6. I am using StopMode to put the uController to sleep.
I have a couple of questions I was wonder if you could help.
1. When waking up from stop mode, do I need to initialize any hardware or clock? I assume that after waking up, the program will continue to execute where the stop mode was entered, correct? In my codes, I would reinitialize the clock again SystemClock_Config(); Are there anything else I need to initialize? Like my ADC, Timer, and so on?
2. In order to debug in stop mode, all I have to do is to program this line?
SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
By the way, I am using KEIL. Does the debugger would start running again after waking up? I am just curious as to
how would the debugger work in stop mode? I guess the debugger would just stop when stop mode is entered, then run
again to the next break point after the uController has waken up?
Thanks in advance.
Here are the my codes to enter stop mode:
/* Enable Power Clock*/
__HAL_RCC_PWR_CLK_ENABLE();/* Allow access to Backup */
HAL_PWR_EnableBkUpAccess(); HAL_RTCEx_DeactivateWakeUpTimer(&hrtc); HAL_SuspendTick(); //enable debug in sleep mode// SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); //enable debug in stop mode SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); SystemClock_Config(); HAL_ResumeTick();