Hi all,
I am having issues getting a timer hwi to run at speeds greater than 80kHz.
The hwi works well for timer speeds up to about 160kHz, but from then on the frequency of the interrupt is capped at about 160kHz.
The code used to setup my timer and hwi, as well as the hwi isr is listed below:
main() {
....
#define CLK_FREQ 30000000 uint32_t ui32ClockFreq; // Set clock frequency ui32ClockFreq = SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, CLK_FREQ); // Enable timer peripheral clock SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); SysCtlPeripheralReset(SYSCTL_PERIPH_TIMER0); while (!SysCtlPeripheralReady(SYSCTL_PERIPH_TIMER0)) { } // Configure the timer TimerConfigure(TIMER0_BASE, TIMER_CFG_A_PERIODIC_UP); TimerLoadSet(TIMER0_BASE, TIMER_A, (ui32ClockFreq / 200000)); // // Setup the interrupt for the timer timeouts. // hwi = Hwi_create(INT_TIMER0A, hwi0_isr, NULL, NULL); IntEnable(INT_TIMER0A); TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); TimerEnable(TIMER0_BASE, TIMER_A); } void hwi0_isr(void) { TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, toggle); GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, !toggle); }
So really my question is am I doing this right? And if so, is there/why is there such a large overhead when using a hwi.
Many Thanks,
Andrew.