I have a strange problem here. I have a idle loop in the RTOS I'm running:
Basically it does a WFI waiting for Systick (or another interrupt) to occur. This I have done successfully on several other NXP CM3/CM4 processors without problem (of course without the DSB/ISB).
However, on the RT1062 I see a problem with this. The idle loop above will not execute the WFI the first 5 seconds the system runs (because of the os_time > 500). I have a interrupt driven output routine that shows the systick timer registers, a counter that shows how many systick has occured and the current CPU clock frequency (uisng CLOCK_GetCpuClkFreq()).
The log from that:
From this it is clear that the systick runs perfectly ok before the 5 seconds has elapsed (and the WFI is called the first time). But, after the WFI has been called the first time, the systick interrupt will be extremely slow. When measuring a GPIO output that toggles on the systick IRQ, I can see it changes from the correct 10 mS to 7124 mS (might be 7124/2, I'm not sure) once the first WFI has been executed. The CPU clock is the same 600 MHz, the configuration of the Systick (CTRL) is the same (0x07) so the clock source is still the core clock.
What am I doing wrong here ?????
EDIT: I have a feeling that the systick stops while the CPU is waiting in the WFI instruction ?
EDIT: Same result if I change the SysTick clock from "internal" to "external" (100 KHz from the 24 MHz xtal osc)