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.
Hi,
I am trying to configure the ePWM module for F2837xD processor in High-Resolution mode for up-down count mode. In the TRM setion 15.2.4.4.1 High-Resolution Period Configuration, it is said that the bits HRPCTL[TBPSHRLOADE] and TBCTL[PHSEN] irrespective of the value in TBPHSHR for up-down count mode.
But in the shipped example, hrpwm_prdupdown_sfo_cpu01, only HRPCTL[TBPSHRLOADE] is set and the TBCTL[PHSEN] is not set for the up-down count mode and the example is still working properly.
In the wiki page http://processors.wiki.ti.com/index.php/C2000_HRPWM_High_Resolution_Period_and_Duty , the solution provided sets both HRPCTL[TBPSHRLOADE] and TBCTL[PHSEN] and later mentions that you can disable both of them if not needed by application.
What is the correct way to do the configuration? Is it mandatory to set TBCTL[PHSEN] and HRPCTL[TBPSHRLOADE] before enabling the TBCLKSYNC for ePWM? Or it is optional? Or it is necessary to set them for entire time ePWM is running for HRPWM period in up-down count mode?
Thanks,
Aditya
Hi Aditya,
If you are using high resolution period control with high resolution phase shift control, please refer to the example code in C2000Ware located at <path_to_C2000Ware>\device_support\f2837xd\examples\cpu1\hrpwm_deadband_sfo_v8. This example implements HRPRD (hi-res period), HRDUTY (duty), HRPHS (phase shift) and HRDB (dead-band) simultaneously. In this case PHSEN and TBPHSHRLOADE need to be handled inside the PWM ISR. (as done in the example)
If hi-res phase shift is not required, then simply enabling PHSEN should suffice. No need for the PWM ISR. If you do not need high resolution period control or if it is a fixed frequency application, then simply enabling TBPHSHRLOADE and PHSEN should suffice. No need for the PWM ISR.
I hope this helps.
Hrishi
Aditya,
You do not need PHSEN if you are not using phase shifting. TBPHSHRE is part of the configuration/initialization routine when Hi-res period is used and that's why it is used in the initialization code (only) of the HRPRD example.
If I try to enable the PHSEN in the above example, the waveform will be totally different than expected. This is because, the INPUT5SELECT of InputXbarRegs is confgured for GPIO0 by default, and ePWM produces PWM output on GPIO0. So whenever there is a pulse in GPIO0 due to the PWM waveform, the phase syncs with the up-down counter as GPIO0 acts as sync input signal. This causes the up-down counter to restart TBPHS value is 0, resulting in a different waveform.
Your comments above are correct for PWM1. If you do not need phase syncing, please disable PHSEN. If you need PWM1 to be synced with an external trigger, xbar needs to be configured accordingly to point to the external input signal.
I hope this helps.
Hrishi