This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCSTUDIO: Question about ADC oversampling and measurement

Part Number: CCSTUDIO

Hello!

Hope you are all well.

In a code example, TI mentions that one can oversample an ADC input to get better resolution of that pin, such as:

AdcaRegs.ADCSOC5CTL.bit.CHSEL = 2; // SOC5 will convert ADCINA2
AdcaRegs.ADCSOC5CTL.bit.ACQPS = 19; // SOC5 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC5CTL.bit.TRIGSEL = 5; // SOC5 will begin conversion on ePWM1 SOCA
AdcaRegs.ADCSOC6CTL.bit.CHSEL = 2; // SOC6 will convert ADCINA2
AdcaRegs.ADCSOC6CTL.bit.ACQPS = 19; // SOC6 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC6CTL.bit.TRIGSEL = 5; // SOC6 will begin conversion on ePWM1 SOCA
AdcaRegs.ADCSOC7CTL.bit.CHSEL = 2; // SOC7 will convert ADCINA2
AdcaRegs.ADCSOC7CTL.bit.ACQPS = 19; // SOC7 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC7CTL.bit.TRIGSEL = 5; // SOC7 will begin conversion on ePWM1 SOCA
AdcaRegs.ADCSOC8CTL.bit.CHSEL = 2; // SOC8 will convert ADCINA2
AdcaRegs.ADCSOC8CTL.bit.ACQPS = 19; // SOC8 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC8CTL.bit.TRIGSEL = 5; // SOC8 will begin conversion on ePWM1 SOCA

But, what do we do with these results contained in the registers when we need to measure the data and perform control algorithms? 
If I need to oversample an output voltage, since it needs to be very accurate, I can call:

volts = AdcbResultRegs.ADCRESULT8; // Read value in ADC reg from SOC8 conversion

But this defeats the purpose of an oversample, since we are just reading a single result in the register. Do we need to average out the sampled results,
and if so, is there an equation that I can implement to do this? I would assume it may be slightly more complicated than a simple average of the four sensor measurements.

Regards,
Joel

  • Hi Joel,

    TI mentions that one can oversample an ADC input to get better resolution of that pin

    Can you please provide further details on below? This would help to route the question to appropriate team.

    1. What is the SoC/TRM you are referring to

    2. Source of the code snippet example you provided (PDK/SDK example source file path)

    Thanks

  • Hi Aravind,

    It was just a general comment - Texas Instruments technical reference states that to increase resolution, one can oversample an ADC pin with multiple SOCs - such as I have with SOC5-8. This code example is also directly from the technical reference manual.

    All I need to know is how to actually process this information within my CLA - do I need to average the 4 different SOC5-8 measurements, if so, how do I do it/is there any equation which states how to get an accurate average of the oversampled SOCs?

    As I mentioned, it seems like online, the references are telling me that the over-sampled ADC value is not just the measurement of the 4 samples summed and divided by 4. 

    Best wishes,
    Joel

  • Hi Joel,

    I do not know the response for your question. I will check within team, to address this question.

    Thanks

  • Hello Joel,

    Different groups support different processors. So you need to tell us which processor you are using, so we can send your question to the right group.

    Regards,

    Nick

  • Hello Nick,

    I apologise. The MCU I am using is F2837xD Dual Core. www.ti.com/.../spruhm8h.pdf

    Best wishes,
    Joel

  • Nick,

    Below is what I am doing at the moment for the oversampled sensors, which release SOC5 through to SOC8 upon sample completion:

    voltage = ((AdcaResultRegs.ADCRESULT5
    + AdcaResultRegs.ADCRESULT6
    + AdcaResultRegs.ADCRESULT7
    + AdcaResultRegs.ADCRESULT8)/4); // Compute the average reading on the over-sampled Output Voltage SOCs

    current = ((AdccResultRegs.ADCRESULT5
    + AdccResultRegs.ADCRESULT6
    + AdccResultRegs.ADCRESULT7
    + AdccResultRegs.ADCRESULT8)/4); // Compute the average reading on the over-sampled current SOCs

    I am unsure whether this is accurate, since there may be more to the samples than I have realised. 

  • Hello Joel,

    Got it. I am passing your question over to the C2000 team. Please ping the thread if you have not received a reply in a day or so.

    Regards,

    Nick

  • Hi Nick/Aravind,

          Thanks for directing this post to the C2000 Team.

    Hi Joel,

         Your assumptions about the ADC results are correct.  The conversion data in the ADCRESULT register is the instantaneous value for each SOC.  You are right about taking the average of SOC5 to SOC8 results for oversampling.

    Best regards,

    Joseph