Other Parts Discussed in Thread: EK-TM4C123GXL
Hi TI:
After looking through the various forum threads on this issue, I still can't figure out why ADCIntStatus() never returns.
Here are the basics.
Part# - EK-TM4C123GXL
OSC - PIOSC I am not using an external clock.
SysCtlClockGet() Returns: 80,000,000
TI-RTOS - 1.10.0.23
ADC - Using "Drivers" Only.
Errata - I went through all of the Errata and "tried" to make sure I was avoiding those issues. Noted in the code below.
EK_TM4C123GXL.c - This is really where the Init() Code Is. The code you see was compacted just a bit.
I am very interested in understanding a few issues.
1. If this is a clock issue, is this a matter of associating the PLL with the ADC module?
I understand the Errata issue; but, I can not translate into Code.
I do not know if TI-RTOS likes having the clock changed.
2. The entire Interrupt issue is a mystery. I so not see what the ADC "driver" code is doing here.
I'm not finding well explained examples for this.
In this environment, I do not seem to have easy access to the Interrupt table. I'll need a bit of explanation here.
3. If above is not the issue, what is?
Any help would be most appreciated.
Thank you.
Rick
Code:
Init(void)
{
// this code is in: EK_TM4C123GXL.c
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0);
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_3);
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_2);
}
void GetData(void)
{
uint32_t uiClock;
uint32_t ui32ADC0Value[8];
iCount++;
// Tiva™ C Series TM4C123x Microcontrollers Silicon Revisions 6 and 7 (Errata)
// ADC#01 - Does not appear to apply
// ADC#03 - More than one Step is used
// No comparator is in use
// This does not appear to be the issue
// ADC#04 - Does not appear to apply
// ADC#07 - Does not appear to apply
// ADC#08 - Enabling the PLL seems to hang the Board or has no effect
// Appears to be using the Precision Internal Oscillator (PIOSC)
// ADC#09 - Does not appear to apply
// ADC#11 - Does not appear to apply
// ADC#13 - Removed PE3 from usage
// ADC#14 - Does not appear to apply
// ADC#16 - Does not appear to apply
// ADC#08 - this causes the program to hang or has no effect - Commented out
// SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |SYSCTL_XTAL_16MHZ);
// Clock Check - Clock: 80,000,000
uiClock = SysCtlClockGet();
System_printf("Clock: %i \n", uiClock);
System_flush();
ADCSequenceDisable(ADC0_BASE, ADC_INT_SS0);
ADCSequenceConfigure(ADC0_BASE, ADC_INT_SS0, ADC_TRIGGER_PROCESSOR, 0);
// ADC#13 ADCSequenceStepConfigure(ADC0_BASE, ADC_INT_SS0, 0, ADC_CTL_CH0); // PE3 Commented out
ADCSequenceStepConfigure(ADC0_BASE, ADC_INT_SS0, 0, ADC_CTL_CH1); // PE2
ADCSequenceStepConfigure(ADC0_BASE, ADC_INT_SS0, 1, ADC_CTL_CH2); // PE1
ADCSequenceStepConfigure(ADC0_BASE, ADC_INT_SS0, 2, ADC_CTL_CH3); // PE0
ADCSequenceStepConfigure(ADC0_BASE, ADC_INT_SS0, 3, ADC_CTL_CH4); // PD3
ADCSequenceStepConfigure(ADC0_BASE, ADC_INT_SS0, 4, ADC_CTL_CH5 | ADC_CTL_IE | ADC_CTL_END); // PD2
ADCSequenceEnable(ADC0_BASE, 0);
//ADCIntRegister(ADC0_BASE, ADC_INT_SS0, &MyISR); // Started thinking about my own interrupt here.
//ADCIntEnable(ADC0_BASE, ADC_INT_SS0);
ADCIntClear(ADC0_BASE, ADC_INT_SS0);
ADCProcessorTrigger(ADC0_BASE, 0);
// Hangs Right Here!
while(!ADCIntStatus(ADC0_BASE, ADC_INT_SS0, false))
{
}
//ADCIntClear(ADC0_BASE, ADC_INT_SS0);
ADCSequenceDataGet(ADC0_BASE, ADC_INT_SS0, ui32ADC0Value); // Watch on ui32ADC0Value
ADCSequenceDisable(ADC0_BASE, ADC_INT_SS0);
ADCIntDisable(ADC0_BASE, ADC_INT_SS0);
System_printf("Data: %i \t %i \t %i \t %i \t %i \t %i \t %i \t \n", iCount, ui32ADC0Value[0], ui32ADC0Value[1], ui32ADC0Value[2], ui32ADC0Value[3], ui32ADC0Value[4], ui32ADC0Value[5]);
System_flush();
return;
}