MATLAB: How to set up “Emulation Mode Bits” for the TC2 ePWM block in Target Support Package TC2 3.1 (R2008b)

Target Support Package TC2

I would like to be able to set bits 14:15 in the ePWM block. In the TI manual "TMS320x280x, 2801x, 2804x Enhanced Pulse Width Modulator (ePWM) Module Reference Guide" the Time-Base Control Register is described. Bits 15:14 are described as the "FREE_SOFT" or "Emulation Mode Bits" which could be set to '1x' to allow the ePWMs to work in free-run mode.
The included header file for the ePWM block, 'DSP280x_EPwm.h' acknowledges the existence of this register bit definition. However, I do not have access to these bits in the ePWM block.

Best Answer

The functionality to set ‘Emulation Mode Bits’ is not available for the TC2 ePWM block in Target Support Package TC2 3.1 (R2008b). These bits are kept as default "00" .
To work around this issue you can change those bits manually in the generated code via
EPwmRegs->TBCTL.bit.FREE_SOFT
For example, consider running ‘c2808adcpwmasynctest’ demo. Generate the code for the model in the demo. Then, in Code Composer Studio you will find the file ‘c2808adcpwmasynctest.c’. In this file, there is a function "config_ePWMRegs" (or one with a similar name). Inside this function you will find the line which is setting CTRMODE bits:
EPwmRegs->TBCTL.bit.CTRMODE = EPwmParams->TBCTL_CTRMODE;
Similarly, you may add the following line to change the FREE SOFT bits:
EPwmRegs->TBCTL.bit.FREE_SOFT= 1x ;