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.

How does ADC RESULTS work? F28377D

Hello all,

I am quite new with F28377D and I am trying to learn about EPwm triggered ADC, by using the Code Composer Studio sample code provided inside: device_support\F2837xD\v130\F2837xD_examples_Cpu1\adc_soc_epwm\cpu01\ccs.

In the "adc_soc_epwm_cpu01.c" file, I can see that the purpose is to fill the "AdcaResults[RESULTS_BUFFER_SIZE]" vector with the results of the ADC conversion. However I would like to understand

1. where are (in the program adc_soc_epwm_cpu01.c) the ADC results are written inside the "AdcaResults" vector? 

Thank you so much

Leonardo

  • Leonardo,

    Leonardo Callegaro said:

    In the "adc_soc_epwm_cpu01.c" file, I can see that the purpose is to fill the "AdcaResults[RESULTS_BUFFER_SIZE]" vector with the results of the ADC conversion. However I would like to understand

    1. where are (in the program adc_soc_epwm_cpu01.c) the ADC results are written inside the "AdcaResults" vector? 

    In the ADCA-1 interrupt ISR.  Look at line 182 of adc_soc_epwm_cpu01.c:

      AdcaResults[resultsIndex++] = AdcaResultRegs.ADCRESULT0;

    Regards,

    David

  • Thanks David.

    1. Does that command AdcaResults[resultsIndex++] = AdcaResultRegs.ADCRESULT0 write 256 values inside the vector AdcaResults?

    and also

    2. When is the "adc_soc_epwm_cpu01.c" program jumping to the "adca1_isr" interrupt?
  • Leonardo,

    The interrupt is being triggered every conversion. Look at the ADC setup in SetupADCEpwm(). No, the cited code line copies one result into the buffer. This is standard C. Nothing tricky going on here.

    - David
  • Thanks David,

    I believe that inside the function SetupADCEpwm(), the specific command saying that the ADC is triggered by the ePWM at every conversion is:

    AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C

    is that correct? Thanks, all this helps me learning
  • Yes, that line of code sets the SOC0 to trigger on the ePWM1 SOC-A or SOC-C signal.

    - David