AnsweredAssumed Answered

Weird behaviour of WFI instruction on stm32L031G6

Question asked by Maciej Kozłowski on Apr 10, 2018
Latest reply on Apr 12, 2018 by Clive One



I found that WFI instruction modify R0 register value. This happens at least on SysTick interrupt. Value, if modified, appears to be mostly 0, but sometimes is random.

WFI behave weird on stm32L031G6, but works ok on stm32L031C4.

Power seems to be ok.


Code showing behaviour:

bkpt 0
movs r0, #8
movs r1, #0
/* replace with nop -> works as expected */
cmp r0, r1
bne WFI_loop
/* this place shall never be reached */
bkpt 1



Attached full code.


I have just tested it on 6 different chips, only 1 of them works as should.