I have a project where the Systick ISR stops running. It works at the beginning of the program, then stops after a few seconds.
I looked in the ICSR register and found:VectPending = 0x10
ISRPending = 1
PendStSet = 1
This is the ISR code:
void SysTick_Handler(void)
{
int i;
if (Function == CONTROL)
i = 3199;
else
i = 9;
SampleCounter++;
if (SampleCounter > i)
SampleCounter = 0;
ProgFlag = true;
}
The rest of the program executes a WFI until ProgFlag is true, then proceeds with the rest of the routine, which clears ProgFlag when it is finished.
Any clues?
Hello,
Is Systick timer still running ?
Have you changed the default Systick interrupt priority ? Maybe another IRQ is blocking the Systick timer interrupt.
Timer is running. Program is in its main WFI loop. The flag on bit 16 has been set, so I know that is has reached zero.
I haven’t deliberately changed the priority, but where do I check what the priority is? And what the priority threshold level is set to?
I don’t remember there being any flag that needs to be reset when executing the ISR.Is that correct?
Hello Ian,
Have you called SysTick_Config() function in your code so that you initialize and start the SysTick timer?
And then the SysTick timer will generate an interrupt in regular basis.
https://arm-software.github.io/CMSIS_5/Core/html/group__SysTick__gr.html
Please refer to this thread : https://community.renesas.com/mcu-mpu/ra/f/forum/18346/systick_handler-ra2e1/60650#60650
And I will attach you an example for EK-RA4M2 which configures the SysTick Timer to blink a led every 500 ms.
The example is on EK-RA4M2.
3603.RA4M2SysTick.zip
Hope it helps.
Best Regards,
IK
Yes, it was configured using SysTick_Config, and it works for a few cycles then stops.
It only does this when running standalone. When I have the e2lite connected it very rarely misbehaves. That is making it tricky to debug, as you might imagine!
Fixed it. It was a brownout problem. (Underestimated the time it would take a small transformer to charge 150000uF)