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.

TMS320F28388D: EPWM SOC scheduling with phase and additional complexity - need guidance

Part Number: TMS320F28388D

Greetings E2E Community!

I am requesting advice about how to configure EPWMs for moderately complex sampling and processing schedule. I am using F28388D.

Multiple PWM outputs are being generated and multiple A/D channels are being sampled per EPWM.

The goal is to have four PWMS running in a 25 uS cycle, with a defined phase offset among them. Each cycle generates two SOCs to drive ADC sampling, and each ADC sample triggers a CLA task. One SOC is generated every cycle and triggers the "Fast Task", and another SOC is generated every fourth cycle and triggers the "Slow Task".

This all works fine by using TBPHS to offset the PWM phases (I use the C200ware calls, such as EPWM_setPhaseShift()), and EPWM_setADCTriggerEventPrescale() to cause the Slow SOC to be generated every fourth cycle.

However the computations that run on every fourth cycle (the "Slow Tasks") need to be scheduled such that they occupy a particular one of the cycles, so that the "Slow Tasks" don't try to execute simultaneously. So the "Slow Task SOC1" should be generated on the first of four cycles of EPWM1, the "Slow Task SOC2" on the second of four cycles of EPWM2, and so forth.

I tried to use EPWM_setADCTriggerEventCountInitValue() to stagger the slow tasks, but when I do that, the slow task is no longer launched at all, so it seems like trying to initialize the event count causes SOC to never be generated. I don't see any example code that uses this feature. Can I get guidance about how to properly use EPWM_setADCTriggerEventCountInitValue()?

Are there other feature of EPWM or ADC that I can exploit to implement the schedule I described?


  • Hi,

    Please refer to the "ETCNTINITCTL Register Field Descriptions"

    • ETCNTINITCTL - These bits enable ETCNTINIT initialization via SYNC event OR via software force.
    • ETCNTINIT - These bits allow you to initialize INT/SOCA/SOCB counters on SYNC events (or software
    force) with user programmed value.

    You may have to use EPWM_enableADCTriggerEventCountInit() and EPWM_forceADCTriggerEventCountInit()