using Tiva launchpad, TM4C123GH6PM
Still learning. Hoping somebody can spot what's wrong. I'm trying to setup a timer to trigger ADC.
.
.
.
.
// ***** ADC STUFF *****
// Debug Blip PA6
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_6);
// The ADC0 peripheral must be enabled for use.
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
// Enable the GPIO port that hosts the ADC
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
// Select the analog ADC function for PE3.
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
ADCSequenceConfigure(ADC0_BASE, 2, ADC_TRIGGER_TIMER, 0);
// Since sample sequence 2 is now configured, it must be enabled.
ADCSequenceEnable(ADC0_BASE, 2);
// Clear the interrupt status flag.
ADCIntClear(ADC0_BASE, 2);
// Enable the Timer peripheral
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
// Timer should run periodically
TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
// Set the value that is loaded into the timer everytime it finishes
// it's the number of clock cycles it takes till the timer triggers the ADC
#define F_SAMPLE 1000
TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet()/F_SAMPLE);
// Enable triggering
TimerControlTrigger(TIMER0_BASE, TIMER_A, true);
// Enable processor interrupts.
IntMasterEnable();
ADCIntEnable(ADC0_BASE, 2);
// Enable the timer
TimerEnable(TIMER0_BASE, TIMER_A);
.
.
.
.
void ADC0IntHandler(void) {
// Clear the interrupt status flag.
ADCIntClear(ADC0_BASE, 2);
// Ignore the data for now
// Debug Blip Hi
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, GPIO_PIN_6);
// Debug Blip Lo
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, 0);
}