Is there a maximum speed to the SysTick interrupt on a EK-TM4C123GXL clocked at 16MHz?
Whats odd is at 400Hz, it seems to work fine. When I up the rate to 800Hz I get odd behaviour.
Specifically I've configured the SysTick via:
// set up the SysTick
SysTickDisable(); // make sure we are down
// SysTickPeriodSet(15999999); // 1s at 16MHz clock
//SysTickPeriodSet(159999); // 100Hz at 16MHz clock - works
SysTickPeriodSet(39999); // 400Hz at 16MHz clock - works
SysTickIntEnable(); // enable the interupt
SysTickIntRegister(SysTickIntHandler); // interup calls this function
SysTickEnable(); // and we are go
The function SysTickIntHandler is:
void
SysTickIntHandler(void)
{
//
// Update the Systick interrupt counter.
//
g_ui32Counter++;
double PhItmp=PhI*dPhI-PhQ*dPhQ;
PhQ=PhQ*dPhI+PhI*dPhQ;
PhI=PhItmp;
}
Now worried that the double precision phasor couldn't be performed quickly enough, commented that out - but still erratic behaviour.
I'm monitoring whats going on in the main loop:
while(1)
{
//
// Check to see if systick interrupt count changed, and if so then
// print a message with the count.
//
if(ui32PrevCount != (int)g_ui32Counter/1000)
{
//
// Print the interrupt counter.
//
UARTprintf("Number of interrupts: %d\tI=%i\tQ=%i\n",
g_ui32Counter,(int)(PhI*65536.0),(int)(PhQ*65536.0));
ui32PrevCount = g_ui32Counter/1000;
}
}
So every 1000 interrupts, it prints out where we are - this means that these prints are under 1Hz rate.
Now at 400Hz interrupt - I can see the interrupt count increasing by counts of 1000 - and that is reliable.
At 800Hz interrupt - the count stalls on 3000, and doesn't increase. Half wonder, is that the the UARTprintf can't be performed at 800Hz, and is interrupted by the SysTick? If so - shouldn't this be clean, e.g. when the interrupt complete, does the cpu go back to the UARTprintf and complete it?
Any ideas? I was hoping to increase the interrupt to 10kHz. Where I want that done at accurate 100us intervals, hence why using an interrupt ...