Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: ENERGIA, EK-TM4C1294XL
Tool/software:
I have uploaded the code below. I am using code composer studio v11.2.
Output of PF_0 toggles 18 times and when interrupt occurs, it stays at high state. I believe I can not clear interrupt flag using ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
Could you comment on following code?
#include <stdint.h>
#include <stdbool.h>
#include "inc/tm4c1294ncpdt.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/timer.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#define SYSTEM_CLOCK 120000000
void Timer0IntHandler(void)
{
ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
digitalWrite(PF_0, 0);
delay(500);
digitalWrite(PF_0, 1);
delay(500);
}
void ConfigureTimer(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
uint32_t timerLoad=399500000;
TimerLoadSet(TIMER0_BASE,TIMER_A, timerLoad - 1);
IntEnable(INT_TIMER0A);
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
TimerEnable(TIMER0_BASE, TIMER_A);
}
void setup(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
pinMode(PF_0, OUTPUT);
SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), SYSTEM_CLOCK);
ConfigureTimer();
IntMasterEnable();
while (1)
{
digitalWrite(PF_0, 0);
delay(100);
digitalWrite(PF_0, 1);
delay(100);
}
}
void loop() {}

