Associate
April 10, 2018
Question
Weird behaviour of WFI instruction on stm32L031G6
- April 10, 2018
- 3 replies
- 2759 views
Posted on April 10, 2018 at 16:23
Hello,
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
WFI_loop:
/* replace with nop -> works as expected */
wfi
cmp
r0
,
r1
bne WFI_loop
/* this place shall never be reached */
bkpt
1
edit:
Attached full code.
I have just tested it on 6 different chips, only 1 of them works as should.