STC Self test assumes that the WFI always causes the standby state. This isn't correct. WFI is a hint - the instruction can be retired without the CPU ever entering standby. It takes some cycles to enter standby due to the need to do things like flush the write buffer, and if during this time an interrupt or debug request occurs - the CPU won't enter standby
A part for the debug request case, We have to be sure STC SelfTest is always executed with interrupt disabled. It is also a good idea to add few NOPs or sequence of jumps before call WFI.
STC Self test assumes that the WFI always causes the standby state. This isn't correct. WFI is a hint - the instruction can be retired without the CPU ever entering standby. It takes some cycles to enter standby due to the need to do things like flush the write buffer, and if during this time an interrupt or debug request occurs - the CPU won't enter standby
A part for the debug request case, We have to be sure STC SelfTest is always executed with interrupt disabled. It is also a good idea to add few NOPs or sequence of jumps before call WFI.