As per my understanding, you are trying to generate complimentory PWM signals for three phase inverter, which is driving a PMSM. In total, you have 6 PWM signals.
You can achieve this using the block "ePWM" found in the library "C2000 Microcontroller Blockset / F28004x". The input to the block "ePWM" is the compare value that needs to be programed into the "CMP" register of microcontroller. C28004x controller has 6 ePWM modules.
in order to illustrate how to configure PWM modules for each leg of inverter, let us suppose that ePWM1 module is used for phase A, ePWM2 module for phase B and ePWM3 module for phase C.
Note: before proceeding, execute the command "c2000setup" in the MATLAB command window and complete all the third party tools installation.
Configure the PWM pins for the inverter:
For enabling Phase A PWM signals:
- Add the block "ePWM" form the simulink library browser.
- Open the block parameters for the each block by double clicking on it and Set the "Module" property to "ePWM1".
For enabling Phase B PWM signals:
- Add the block "ePWM" form the simulink library browser.
- Open the block parameters for the each block by double clicking on it and Set the "Module" property to "ePWM2".
For enabling Phase C PWM signals:
- Add the block "ePWM" form the simulink library browser.
- Open the block parameters for the each block by double clicking on it and Set the "Module" property to "ePWM3".
For each of the "ePWM" block added, configure the "deadband unit" as "Active high complementary". This will generate complimentary PWM signals on ePWM1A and ePWM1B along with deadband. This is what you want for each leg of the three phase converter. Below given screen-shots shows the changes that need to be made in "deadband unit"
] refer to the below documentation for more clearity:
Click on the "Counter Compare" tab and make the following changes:
- set the "specify CMPA via" property to "input port"
- set the "specify CMPB via" property to "Specify via dialog"
- Set an initial value in the "CMPA initial value" field. (it can be any thing, say 50% of TBPRD value)
- Set an initial value in the "CMPB initial value" field. (it can be any thing, say 50% of TBPRD value)
Click on the ePWMA tab and make following changes:
- click the check box corresponding to "Enable ePWM1A".
- Set the property "Action when counter=CMPA on up-count (CAU)" to "clear"
- Set the property "Action when counter=CMPA on down-count (CAD)" to "Set"
- Set the property "Action when counter=CMPB on up-count (CBU)" to "Do nothing"
- Set the property "Action when counter=CMPB on down-count (CBD)" to "Do nothing"
click the ePWMB tab and ensure that "Enable ePWM1B" is not checked.
By making the above changes, you will be able to generate the PWM signals as shown in the below image:
Configure GPIOs PWM pins.
Here, following GPIOs are configured as PWM pins. (You may change them by refering the Technical reference manual for c280004x microcontrollers).
- GPIO0: ePWM1A
- GPIO1 : ePWM1B
- GPIO2 : ePWM2A
- GPIO3 : ePWM2B
- GPIO4 : ePWM3A
- GPIO5 : ePWM3B
Go to the "Hardware" tab found in the simulink toolstrip. Navigate to "Hardware Settings" . Expand the "Target hardware resources" drop down as shown in the below figure.
Then, navigate to the "ePWM" tab found under "Target hardware resources", and configure the GPIOs as shown in below figure:
Refer to the below documentation to get more understanding about "ePWM" block:
For more detailed information about how to configure different peripherals of C2000 microcontrollers, refer to the link:
I hope you find this usefull !!