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.

SOC pwm trigger

Hello,

I use pwm1 as a trigger for ADC SOC. Epwm1 is configured as:


   EPwm1Regs.ETSEL.bit.SOCAEN    = 1;        // Enable SOC on A group
   EPwm1Regs.ETSEL.bit.SOCASEL    = 4;        // Select SOC from from CPMA on upcount
   EPwm1Regs.ETPS.bit.SOCAPRD     = 1;        // Generate pulse on 1st event
   EPwm1Regs.CMPA.half.CMPA     = 0x0080;    // Set compare A value
   EPwm1Regs.TBPRD                 = 0xFFFF;    // Set period for ePWM1
   EPwm1Regs.TBCTL.bit.CTRMODE     = 0;        // count up and start

When i change EPwm1Regs.CMPA.half.CMPA during runtime it seems that in some cases no further ADC conversions are executed.

How is this possible?

Regards

  • Would you please provide more information on when you think the conversions don't work or work? Please check if your ADC conversion works for a fixed compare value say for example with 0x0080 (when period is 0xFFFF). If that works then you need to be careful when triggering ADC with a variable compare value ... try not to have compare value equal to 0% or 100% of your period value. I am assuming you have up-count mode only. In an up-down count mode you need to be careful about not starting two conversions too close by having a compare value close to your period value.