cancel
Showing results for 
Search instead for 
Did you mean: 

Untimely wakeup during WFE on stm32g431.

treguy
Associate

I have a project in which I try to sync my assembly code on a signal on a GPIO, using WFE for minimum latency and jitter.
I use a Rust HAL ony for initialisation of the clock and to put some GPIOs into input mode, and one in output mode that I use to check the timings of my assembly code with an oscilloscope.

The synchronization works (PA15 in input mode, using EXTI line 15 to send the wake-up event), but the WFE also wakes up at regular interval. Apparently every second when no debuger is connected, and maybe a bit slower when openocd / gdb is connected.

I try to understand why it does wake-up, but really can't find anything. Here are the sources of wake-up I checked:

- Interruptions:
SEVONPEND is zero

(gdb) x/t 0xE000ED10
0xe000ed10:	00000000000000000000000000000000

and if I replace the stack with $AAAAAAAAs, I see no trace of an interruption being called when the core wakes up.

- Event on EXTI lines:
EXTI_EMR1 and EXTI_EMR2 only activate Px15

(gdb) x/t 0x40010404
0x40010404:	00000000000000001000000000000000
(gdb) x/t 0x40010424
0x40010424:	00000000000000000000000000000000

and if I set EXTI_EMR1 to 0x0, the code no longer wakes up on PA15 transitions but continues to wake up regularly every second

- SEV instruction executed by other core
the stm32g431 has only one core

I know WFE is not guaranteed to not continue when no event is raised, but is there a way to understand why it does ?

thank you

0 REPLIES 0