STM8 ASM safely performs WFE

I have c code that runs from RAM in low power mode (so the interrupt is not processed). This mode is activated using a code sequence:

  • go to RAM
  • SIM
  • turn off the internal flash and power control, switch to low-speed sync source (LSE)
  • do some work with WFE (low power standby)
  • turn on the power controller and flash, restore the source of synchronization
  • Rim
  • transition to flash

Thus, there is no problem with the WFE instruction described in the error sheet. The problem with this design is that it can cause the CPU to lock in standby low power permanently:

while nbit(TIM1_SR1,CC3IF) asm("wfe");

which parses as:

000035    720252B602     BTJT      TIM1_SR1, #1, 0xB6
00003A    728F           WFE

, , WFE:

  • BTJT 2 5;
  • , , , "" .

PM0044, 26 :

Code execution example from RAM

2 , 3 . , BTJT WFE.

( > wfe > )?

+4
2

OP:

( ) , :

, WFE .

+1

WFE, , " ".

, STMicroelectronics, :

:

1:
WFE MSB 32- , , WFE ( ISR ) .

2:
, WFE . WFE, ISR

2 , : " , ". WFE, , , .

1 , WFE 32- . , , WFE , , . align, , , , NOP. " " errata:

WFE

     WFE
     JRA next
next:

, , , 2- NOP WFE. , , CPU WFE, ( ) 32- . 2- NOP , , .

+5

All Articles