TMS320F28379D: ePWM missing pulses occasionally in variable frequency application

Part Number: TMS320F28379D

Tool/software:

As part of a phase-controlled converter application, we require two PWM drives which can vary their relative phase in both directions and also operate with variable frequency. Our application uses ePWM1 as a sync source for ePWM4 and both are running in up-down counter mode. The ePWM1 sync out event is CTR=0 and this is used to load PHS=0.5*TBPRD in ePWM4 and start counting down after sync. This phase value can be modified by the action of the controller, up (towards +180°) or down (towards -180°).

Calculation of new frequency value and writing those new values to ePWM modules is handled by a constant rate ISR task.

Here is a simple version of exemplary model in Simulink where frequency is gradually incrementing up to a value before resetting again.

When the frequency is constant (i.e. with TBPRD fixed), the scheme works as intended. However, when TBPRD is varied and when ePWM4 PHS=0.5*TBPRD, pulse dropping on ePWM4 occurs when the frequency is increasing (but not in the case of decreasing frequency).

It appears that the dropping/missing pulse event only happens when the phase of ePWM4 is very close or equal to 0.5. However, the exact problematic range depends on the rate of change of frequency.

If the SYNCO of ePWM1 is disabled, the missing/dropping of pulse does not occur, but in our application, sync is required to load the required phase value into ePWM4.

We have noticed that this is linked to CTRD = CMPA and CTRD = CMPB but do not know why that is.

Attached screenshots of oscilloscope shows ePWM1 in yellow, ePWM4 in cyan and trigger event (CTRD = CMPA) output on GPIO toggle in magenta.

When PHS=0.5*TBPRD in ePWM4, those trigger events (CTRD = CMPA) are not occurring as regular as expected, with intermittent missing pulse happening from time to time.

However, when PHS=0.501*TBPRD in ePWM4, those trigger events seem regular as expected, with ePWM4 not missing any pulses.

Any advice and explanation would be much appreciated.
Thanks

  • Hello,

    This is an issue that happens on Type-4 ePWM if couple of things are not implemented. On the first look, the most probable issue is that TBPHS does not update at the same time as CMPA and TBPRD but one period later. It happens because TBPHS does not have shadow register and then action on CMP gets missed for that cycle. The fix would be to use CMPA and CMPB to generate your waveforms instead of TBPHS register.

    But to get more information and assist you correctly, could you tell me whether you are using global loading (which should be used with variable frequency application)? How are you setting and clearing your PWM waveform?

  • Hi Stevan,

    Thank you so much for your reply. We do want to use the global load but I have not yet been able to find that option in Simulink. My understanding is that we might have to use custom code within Simulink to enable the relevant registers? Also, reading this document, there could be a boundary case appearing in the application that needs to be mitigated by the workarounds mentioned in there. I have not explored those in terms of how I could implement those workaround in Simulink.

    Regarding, setting and clearing of PWM waveform, please see the attached picture.

    Thank you. Slight smile 

  • Hi Hitesh,

    Yes, the global load feature is not available with MATLAB today and you need to configure it manually through code.

    I have filed a request to MathWorks on your behalf - Missing EPWM features in C2000 Blockset - MATLAB Answers - MATLAB Central

    Thanks,
    Aditya

  • Thank you so much Aditya. We will await for the updates.

    Best regards,

    Hitesh

  • Hi Stevan,

    Hope you are doing well.

    I am wondering if global load will resolve my issue? Do you think it will?

    Thanks.

  • Hello Hitesh,

    Using global load would make sure all registers update at the same time at specified event. It is always recommended to use global load feature with variable frequency application.

    Using CMPA and CMPB method to add the phase shift would solve an issue with TBPHS missed action and a glitch. TBPHS does not have shadow register unlike CMPx registers.