Hello,
I am trying to create a timer that will toggle a GPIO pin at a specified rate. The fastest that I can get the pin to toggle is 1.77us. But unfortunately, I need to be able to toggle this pin at 0.33us. I have attached my code below on how I am setting the timers and servicing the interrupt. Would anyone be able to make a recommendation as to how I might achieve a shorter period?
Thanks,
Logan
void ConfigureTimer0(void){
// Enable timer0 peripheral
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
// Configure timer0 to run once and stop
MAP_TimerConfigure(TIMER0_BASE, TIMER_CFG_ONE_SHOT_UP);
TimerClockSourceSet(TIMER0_BASE,TIMER_CLOCK_SYSTEM);
// Enable timerA interrupt
MAP_IntEnable(INT_TIMER0A);
// Enable interrupt for timerA0
MAP_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
}
void SetPeriodEnableTimer0(unsigned long period){
// Set timerA0 period
TimerLoadSet(TIMER0_BASE, TIMER_A, period);
MAP_TimerEnable(TIMER0_BASE, TIMER_A);
}
void Timer0IntHandler(void){
// Clear interrupt
MAP_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
if(GPIOPinRead(GPIO_PORTH_BASE, GPIO_PIN_3)){
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_3, 0);
}
else{
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_3, 255);
}
SetPeriodEnableTimer0(1);
}