Hi. I've been trying to get my tiva's adc setup, but while stepping through the code it hangs and loops endlessly in FaultISR() when it gets to a certain point, viz., any function/routine that starts with ADC...(). The relevant code is as follows:
/*
* Setup PortE
* APB 0x4002:4000
* AHB 0x4005:C000
*/
if (SysCtlPeripheralPresent(SYSCTL_PERIPH_GPIOE)) {
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); // ADC for Vin and Batt monitor
GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, (GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3)); //
GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, (GPIO_PIN_0 | GPIO_PIN_4 | GPIO_PIN_5)); //
if (SysCtlPeripheralPresent(SYSCTL_PERIPH_ADC0)) {
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
GPIOPadConfigSet(GPIO_PORTE_BASE, (GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_ANALOG);
GPIOPinTypeADC(GPIO_PORTE_BASE, (GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3)); //
ADCClockConfigSet(ADC0_BASE, (ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_HALF), 1);
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
//ADCSequenceStepConfigure(ADC0_BASE, 0, 0, (ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH0));
//ADCIntClear(ADC0_BASE);
//ADCIntRegister(ADC0_BASE, 0x0000, ADC0IntHandler);
//ADCSequenceEnable(ADC0_BASE, 0);
//ADCProcessorTrigger(ADC0_BASE, 0);
}
if (SysCtlPeripheralPresent(SYSCTL_PERIPH_PWM0)) {
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
GPIOPinConfigure(GPIO_PE4_M0PWM4);
GPIOPinConfigure(GPIO_PE5_M0PWM5);
//GPIOPinTypePWM(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5); //
}
}
My clock setup, if it's relevant, is as follows:
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
I have noticed that while every other function name, eg., SysCtlPeripheralPresent(), is highlighted in some purplish color, the ones beginning with ADC are not, eg., ADCClockConfigSet(). I'm using CCS6, by-the-way. I have included adc.h and the code does compile without errors or warnings.
This is my first attempt at programming a tiva and I'm not sure if some of the function calls are redundant.
Thanks for any help.