This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

wfi instruction stops systick timer

I am writing my own code (no libraries etc.) on nRF52832.

For new i still have softdevice and bootloader in flash, and store my program using bootloader protocol, but my program is self contained and doesn't use any of it's code

My interrupt vector table contain pointer to systick handler, and UARTE interrupt handler.

Systick is set to generate interrupt every 1ms.

Both interrupt works properly. This is not the first time i write program to Cortex-M4 based device, i an not a novice. Which does

The problem is when using WFI instruction. 

When executing WFI instruction Systick counter stops and doesn't generate interrupts.

If before WFI instruction UARTE is sending data, UARTE interrupt is generated, handled and WFI properly works for this.

But not with systick alone. Cortex SYST_CSR register is set to 0x3 (normal sleep, no deep).

Cortex SCR register is 0, tried 0x10 - same.

of course i could simply use timer instead of systick but i would like to know why it doesn't work.

Related