2019-04-19 12:15 PM
I'm using the STM32L152. At certain points in my code I go into STOP mode. It seems to come out immediately. I'm not sure what interrupt or event is causing this. Is there any indication somewhere what event caused the processor to change modes? Thanks.
2019-04-20 03:03 AM
Did you have a look at:
The reset source can be identified by checking the reset flags in the control/status register,
RCC_CSR (see Section 6.3.14).
?
2019-04-22 05:33 AM
Since any interrupt will wake the core from SLEEP mode you can look at the SCB->ICSR register in the Cortex core peripheral set. It will report the active interrupt request as an index into the vector table. Should work for STOP also if you use interrupts instead of events.
Jack Peacock
2019-04-22 06:38 AM
Almost certainly systick
use HAL_SuspendTick(); HAL_ResumeTick(); around the sleep period