Systick ISR not running [RA4M1]

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;


i = 9;


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?