Hi,
I often use the low power modes on STM32, and get woken up by a GPIO pin. It just occurred to me that there would be a race if the pin I am waiting for has already changed state before going into a low power state.
For instance,
if( palReadPad( ... )) {
PWR->CR |= ....;
...
__WFI();
}
In the unlikely event that pin changes state before __WFI() is called, I will miss the event. Is there a sane way to mitigate this?
Potential race before entering low power state on STM32
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Potential race before entering low power state on STM32
An external delay added to the line maybe.
Giovanni
Giovanni
Re: Potential race before entering low power state on STM32
Hi.
Use event instead of interrupt. Event will set pending bit, which may cleared only by WFE instruction.
Use event instead of interrupt. Event will set pending bit, which may cleared only by WFE instruction.