Hello,
First of all thank you for always answering my questions extremely fast and sorry for bombarding you with questions every day.
The question today is:
- Why does the WFI instruction (going into idle mode during stc self check) causes an undefined interruption? This just causes the boot process to stop and it doesn't reset.
void stcSelfCheck(void) { unsigned int i; SYSReg2->STCCLKDIV = (0x3U << 24); STCReg->STCGCR0 = (1U << 16U) | 1U; STCReg->STCSCSCR = 0x1AU; STCReg->STCTPR = 0xFFFFFFFFU; for (i = 0U; i < (32U); i++) STCReg->STCGCR1 = 0xAU; for(i = 0U; i < 32U; i++); asm(" WFI"); /*Idle the CPU so that the self-test can start*/ asm(" NOP"); asm(" NOP"); asm(" NOP"); asm(" NOP"); }
I really don't understand what's going on. This behaviour occurs every single time the system is booting when it should've gone into reset due to the stc self check
EDIT:
Which is strange, because whenever I execute the stcSelfCheck, it changes SYSESR (@0xFFFFFFE4) to 0x20, which means that a CPU reset occured (bit 5 of SYSESR), which, in turn, means that a reset occurred, but instead of going to address 0x0 it goes into the next form of interruption (undefined)