Hello I am Sky.
I am struggling with implementation of a ADC oversampling issue in TM4C123.
When I am following a document named "ADC Oversampling Techniques for Stellaris® Family Microcontrollers" (spma001a.pdf),
I should add code on two parts: 1) setting part, 2) data acquisition part
1) In setting
// // Initialize the ADC to oversample channel 1 by 8x using sequencer 0. // Sequencer will be triggered by one of the general-purpose timers. // ADCSequenceConfigure(ADC_BASE, 0, ADC_TRIGGER_TIMER, 0); ADCSoftwareOversampleConfigure(ADC_BASE, 0, 8); ADCSoftwareOversampleStepConfigure(ADC_BASE, 0, 0, (ADC_CTL_CH1 \ | ADC_CTL_IE | ADC_CTL_END));
2) In data acqusition part,
// // Clear the ADC interrupt // ADCIntClear(ADC_BASE, 0); // // Get averaged data from the ADC // lStatus = ADCSoftwareOversampleDataGet(ADC_BASE, 0,&g_ulAverage);
Then, here is my problem.
When I refer to the datasheet of TM4C123GH6PM (tm4c123gh6pm.pdf),
ADCSAC register represents a status of oversampling setting.
I guess that it should return 0x3 as I set 8x oversampling, but it returns always 0 as belows:
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0); ADCSoftwareOversampleConfigure(ADC0_BASE, 0, 8); ADCSoftwareOversampleStepConfigure(ADC0_BASE, 0, 0, (ADC_CTL_CH1 | ADC_CTL_IE | ADC_CTL_END)); uint32_t val = HWREG(ADC0_BASE + ADC_O_SAC); //it returns 0!!!!!
Is there any additional settings to use ADC oversampling?
Please answer my question.
Thanks in advance.
+ Additionally. my desired specification is
1) Read two ADC channel concurrently (ADC0, ADC1)
2) 1Mhz sampling rate / 8 samples = 125khz sampling rate
-Sky