SPRUJD3A July 2025 – October 2025 F28E120SB , F28E120SC
FILE: mcpwm_ex5_tripzone.c
This example configures myMCPWM0 and myMCPWM1 as follows myMCPWM0 Time Base Configurations In Up Count Mode for 15999 TBCLKs or 10KHz Frequency for TBCLK of 160MHz Action Qualifier configurations Output A1/B1: Set High on Counter Zero, Set Low on Counter matches CMPA/CMPB counting up Output A2/B2: Set Low on Counter Period, Set High on Counter matches CMPA/CMPB counting up Output A3: Set High on Counter matches CMPA, Set Low on Counter matches CMPB counting up Output B3: Set Low on Counter matches CMPA, Set High on Counter matches CMPB counting up Trip Zone Configurations CBC1 is source of the CBC trip. CBC Clear is "counter = zero" event TZA is configured for Setting Low, TZB is configured to Setting High Interrupt Configurations Interrupt is configured for CBC trip
myMCPWM1 Time Base Configurations In Up Down Count Mode for 8000 TBCLKs or 10KHz Frequency for TBCLK of 160MHz Action Qualifier configurations Output A1: Set High on Counter matches CMPA counting up, Set Low on Counter matches CMPA counting down Output B1: Set High on Counter matches CMPB counting up, Set Low on Counter matches CMPB counting down Trip Zone Configurations OSHT1 is source of the OneShot trip TZA is configured for Setting Low, TZB is configured to Setting High Interrupt Configurations Interrupt is configured for OST trip
myGPIO0 and InputXbar and PwmXbar GPIO6 is configured in Output Mode and is connected to InputXbar13 This InputXbar instance is connected to the PwmXbar instance that connects to trip This is used for triggering the Trip Input Trip Signal Routing +-----+ +--------------+ +----+ +------------+ | | | | | | -->| CBC1 (MCPWM0) | | GPIO6 |--->| INPUTXBAR_IN13 |--->|PWMXBAR|| +------------+ | | | | | | -->| OSHT1(MCPWM1) | +-----+ +--------------+ +----+ +------------+
If external trip is used by the user, please configure GPIO6 as input mode and remove the GPIO6 driving code from the example
External Connections
Observe the trip input on GPIO6: Observe J4 32 - GPIO6 - Trip Input Monitor the MCPWM pins for the waveforms: Observe J4 40 - GPIO0 - myMCPWM0 Output A1 Observe J4 39 - GPIO1 - myMCPWM0 Output B1 Observe J4 38 - GPIO2 - myMCPWM0 Output A2 Observe J4 37 - GPIO3 - myMCPWM0 Output B2 Observe J4 36 - GPIO4 - myMCPWM0 Output A3 Observe J4 35 - GPIO5 - myMCPWM0 Output B3 Observe J1 7 - GPIO12 - myMCPWM1 Output A1 Observe J2 19 - GPIO29 - myMCPWM1 Output B1