This example demonstrates the functionalities of epwm working in DE mode, the trip inputs are sourced from other epwm instances only and not from cmpss.
All total 7 epwm instances have been used out of which EPWM0A (EPWM7A in case of AM261x-LP) and EPWM1A are made to be TripH and TripL sources respectively.
The screenshots attached in the documentation are as per the results obtained by executing the example on CC. Please note that there are some instance differences between CC and LP.
The mapping is such that:
EPWM0A(B) on CC <--> EPWM0A(B) on LP
EPWM1A on CC <--> EPWM1A on LP
EPWM2A(B) on CC <--> EPWM2A(B) on LP
EPWM3A(B) on CC <--> EPWM3A(B) on LP
EPWM4A(B) on CC <--> EPWM9A(B) on LP
EPWM5A(B) on CC <--> EPWM13A(B) on LP
EPWM6A(B) on CC <--> EPWM12A(B) on LP
The above diagram shows the configuration for EPWM0A (TripH) (EPWM7A in case of AM261x-LP) and EPWM1A (TripL) and the ones marked as Channel A and B are consistent across the remaining 5 epwm instances.
The table below summarizes the configurations of the EPWMs for the given submodules mentioned in the column.
All EPWM instances with DE mode enabled are configured such that on entering into the DE mode, Channel A will be driver by TripH and Channel B will be driven by TripL. DE mode for EPWM4 is disabled and has been used here for the purpose of comparison. Note that EPWM0B has been used to show the TripHorTripL waveform by using ICL for the sake for easy understanding and is not necessary for this example.
OutputXbar13 is used to route the PWMSYNCOUT from EPWM4. OutputXbar14 is used to route the DE_Trip from EPWM6.
In the below section, we will be discussing about various cases which can be observed by varying the configurations inside DE.
EPWM2 is configured in CBC mode where on occurrence of every PWMSYNC it evaluates if TRIPHorTRIPL condition is present and if not then DEACTIVE flag is cleared.
Channel A:
Initially when TripHorTripL was 0, EPWM2A was following the normal action configured in the AQ. We can compare this with EPWM4A. Once TripHorTripL gets High as marked by the red single marker, it enters into the DEACTIVE mode and now EPWM2A is driven by TripH as per the configuration.
The region bounded by the green pair of markers denote the zone where EPWM2 is out of DEACTIVE mode. How? Observe the PWMSYNCOUT coming before the instance marked by first green marker, EPWM2A was still in the DEACTIVE mode as TripHorTripL was high. On occurrence of this PWMSYNC (marked by first green), since TripHorTripL goes low, DEACTIVE flag will get cleared and EPWM2A starts following the normal AQ actions (take EPWM4A as reference). Recall that we have configured EPWM0 (EPWM7 in case of AM261x-LP) and EPWM1 such that they alternate their AQ actions after a period of 5 and 10 TBPRDs respectively. This is the reason why we see that TripHorTripL remains LOW for min(5, 10) i.e. 5 PWMSYNCs. After that again EPWM2 enters into DEACTIVE mode.
Channel B:
We take the same instant for explaining the behaviour for EPWM2B. At red marker, EPWM2 enters into DEACTIVE mode. Till that point EPWM2B was driven by its AQ actions (take EPWM4B as reference). After this red point, TripL drives EPWM2B and not by AQ anymore. The effect can be observed better at the violet marker point where EPWM2B goes low as TripL also goes low. For the next 5 PWMSYNCs, TripHorTripL is High so EPWM2B is driven by TripL during this entire period.
This shows the period where EPWM2 exits the DE mode and EPWM2B generates signals as per its AQ actions until the second green marker. At this point it again enters the DEACTIVE mode and since TripL is low, EPWM2B is immediately pulled down to Low. The little green High signal that we observe at the beginning of this Exit zone is due to the AQ action. As PWMSYNC clears the DEACTIVE flag, EPWM2B resumes its normal behaviour (take EPWM4B as reference) just when its about to go low with its TBCTR reaching TBPRD.
EPWM3 works in DE OST mode where if once entered into the DEACTIVE mode, it remains there until the flag is software cleared. Here we don’t software clear it to see the difference. EPWM2A(B) are also shown for comparison along with EPWM4A(B).
Channel A:
It will be redundant to explain the behaviour of EPWM in DEACTIVE mode. But what’s important here to notice is that, even after exiting from DEACTIVE mode (marked by green pointer) unlike EPWM2A, EPWM3A remains low i.e. it’s still being driven by TripH.
Channel B:
For EPWM3B also, it doesn’t recover even after exiting the DEACTIVE mode and remains low in this period as TripL is also low.
EPWM5 works in DE CBC mode but with Re-entry delay = 8. This means once EPWM5 exits the DEACTIVE mode, for next 8 PWMSYNCs it won’t enter into DEACTIVE mode even if TripHorTripL is High. EPWM2A(B) are also shown for comparison.
Channel A:
The red marker marks the exit of DEACTIVE because that’s the point where PWMSYNC comes and TripHorTripL is low. At this point, the Re-entry counter will get loaded with the Re-entry value i.e. 8 in our case. It will decrement by one on every PWMSYNC. The trip signals are blocked as long as counter value is greater than 0. The counter reaches 0 on occurrence of PWMSYNC which comes at the dotted blue marker. If we see carefully, the EPWM5A now is driven by TripH from this point.
Channel B:
Here also we can see that till the counter reaches 0, EPWM5B continues its normal action by AQ. On the counter reaching 0, TripL starts driving it.
EPWM6 works in DEL OST mode and here the DE mode monitor is enabled. The DEMONTHRES.THRESHOLD = 200, DEMONSTEP.INCSTEP = 20, DEMONSTEP.DECSTEP = 0. So on every PWMSYNC, if TripHorTripL is High, DEMONCNT.CNT is increased in steps of 20 (INCSTEP) and decremented in step of 0 (DECSTEP) if TripHorTripL is Low.
Once the counter reaches the threshold, DE_TRIP pulse is generated and the counter is cleared.
In this example we take the DE_TRIP pulse as the TRIPIN to the same instance and call TZ interrupt on the occurence of trip event. Inside the ISR we software clear the DEACTIVE flag after putting some delay.
Channel A:
The 5th waveform shows the DE trip events that is generated every time the DEMONCNT.CNT reaches the threshold. Initially when no trip is there, the counter will be set to its reset value i.e. 0. When PWMSYNC comes and TripHorTripL ==1, then counter starts counting in the steps of 20. Again when TripHorTripL is gone, the counter will hold the value i.e. 100 in this case. Once it reaches 200 which is the threshold the DE_trip comes. On getting this DE_trip as the TRIPIN source to EPWM6, the DEACTIVE flag is cleared after some delay. In the ISR we have written some dummy code to introduce the delay. The reason behind doing this is that we want to push the clearing of the DEACTIVE flag to the time where TripHorTripL is low so that the clearing will take effect. Otherwise if TripHorTripL is high and the clearing also happens that the same time, then it won’t take any effect. We can see at the green single marker point that it has resumed its AQ action (take EPWM4A as reference). EPWM3A which works in OST has been added for comparison.
Channel B:
Similarly for channel B, the flag gets cleared at the point marked by the green single pointer after which it resumes it normal AQ actions.
When using AM263PX-CC with TMDSHSECDOCK (HSEC180 controlCARD Baseboard Docking Station)
| Parameter | Value |
|---|---|
| CPU + OS | r5fss0-0 nortos |
| Toolchain | ti-arm-clang |
| Board | am263px-cc, am263px-lp |
| Example folder | examples/drivers/epwm/epwm_diode_emulation/ |
Shown below is a sample output when the application is run,