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.

TMS320F28051: Read the ADC value at the midpoint of the PWM signal

Part Number: TMS320F28051

Hello team,

I am supporting an application where there is two actuators being driven by PWM signal (up to 80% duty cycle, 10kHz) from EPWM5A and EPWM5B that we are detecting current from into ADCINA0 and ADCINA5 on TMS320F28051.

Is it possible to configure the software to read the ADC value at the midpoint of the PWM signal, if so, is there any specific documentation you could share?

  • Victor,

    The EPWM can be configured to generate ADC SOC triggers when CMPA/CMPB match the TBCTR value. All you have to do is set the appropriate CMPA/CMPB values whenever the duty-cycle is changed through TBPRD. You can reference the adc_soc example code for this.

    This isn't quite as easy if you are changing the duty-cycle through asynchronous trips because you have no way to determine what the duty cycle will be for each period.

    -Tommy
  • Victor,

    Correction: I suppose you wouldn't want to change the duty cycle with TBPRD.

    If you change the duty cycle with CMPA, then CMPB can be used for the SOC trigger point.

    If both CMPA and CMPB are being used, an unused EPWM module can generate the SOC triggers.

    -Tommy