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.

TMS320F280045: ADC oversampling for certain (defined) ctr== prd events

Part Number: TMS320F280045
Other Parts Discussed in Thread: C2000WARE

Hello, I would like to configure my ADCA A2 for oversampling. As shown in the concept diagram, in the picture below.

I would like to use EPWM1 as 16kHz PWM, and with that I would like to oversample my ADC Input A2 with SOCA event at ctrA == PRD event.

Then using EPWM2 as 4kHz PWM, with ctr=ZERO interrupt, calculate the average of the ADC result registers for SOC0 to SOC3.

The question is -> How can I configure the oversampling ADC based on Ctr == PRD events, and not sequentially one after another. (As listed in 13.4.2 Oversampling Conversion from ePWM Trigger -> in the reference manual).

(I cant use Interrupt Subroutine at EPWM1SOCA trigger event): 

Any Inputs and ideas would be really appriciated.

  • Hi Deep,

    Please take a look at example adc_ex12_burst_mode_oversampling under C2000Ware examples.  This is using burst mode to trigger ADC conversions from PWM such that when counter reaches period, EPWMSOC triggers consecutive conversions of SOCs for x2, x4 and x8 oversampling within the EPWM period.  It should satisfy what you are looking for.  Give the example a shot and let me know if you have any questions.

    Regards,

    Joseph

  • Thank you Joseph for your input. I have a special requirement of acqiuisition at ctr == prd events for consiquitive 4 periods. And then to read and average the data at my next interrupt. What you suggest and the burst mode example do not solve my requirement. I looked at all the available examples before posting here to make sure I wasn't asking a redundant question.

    Thanks again for the reply.

  • Hi Deep,

    Ok, understood.  I'm checking to see how to generate an ISR on EPWM2 when CTR=0.

    Regards,

    Joseph

  • Hi Deep,

    You can configure EPWM2 to generate an interrupt when CTR = 0.  First, enable interrupt using function EPWM_enableInterrupt, then enable an interrupt for event ctr=0 with EPWM_setInterruptSource(EPWM2_BASE, EPWM_INT_TBCTR_ZERO).  You can then do the result accumulation of SOC0-SOC3 (then right shift the result by 2) in the ISR for average calculation.  Remember to clear and acknowledge the interrupt to prevent overflow,

    Hope this helps.

    Regards,

    Joseph 

  • Thanks Joseph for the reply, 

    I could actually generate the EPWM Interrupt and calculate Average, main Issue I was facing was to trigger the SOC0 to SOC4 at every ctr==PRD event. I figured it out, As you suggested, Using burst mode but then using Round Robin mode of operation; I can basically achieve it. WIll test it and let u know here. 

    Your answer did lead me to a direction, Just that I wanted not consecutive SOC but at ctr == PRD event. 

    Thanks a lot for your inputs. 

    Really grateful 

    Regards
    Deep

  • Hi Deep,

    Ok, hope your checkout would produce the results you are looking for..  Let me know if you have further questions.

    Best regards,

    Joseph