SPRACZ1 October 2021 F29H850TU , F29H859TU-Q1 , TMS320F280021 , TMS320F280021-Q1 , TMS320F280023 , TMS320F280023-Q1 , TMS320F280023C , TMS320F280025 , TMS320F280025-Q1 , TMS320F280025C , TMS320F280025C-Q1 , TMS320F280040-Q1 , TMS320F280040C-Q1 , TMS320F280041 , TMS320F280041-Q1 , TMS320F280041C , TMS320F280041C-Q1 , TMS320F280045 , TMS320F280048-Q1 , TMS320F280048C-Q1 , TMS320F280049 , TMS320F280049-Q1 , TMS320F280049C , TMS320F280049C-Q1 , TMS320F28044 , TMS320F28075 , TMS320F28075-Q1 , TMS320F28076 , TMS320F28374D , TMS320F28374S , TMS320F28375D , TMS320F28375S , TMS320F28375S-Q1 , TMS320F28376D , TMS320F28376S , TMS320F28377D , TMS320F28377D-EP , TMS320F28377D-Q1 , TMS320F28377S , TMS320F28377S-Q1 , TMS320F28378D , TMS320F28378S , TMS320F28379D , TMS320F28379D-Q1 , TMS320F28379S , TMS320F28384D , TMS320F28384D-Q1 , TMS320F28384S , TMS320F28384S-Q1 , TMS320F28386D , TMS320F28386D-Q1 , TMS320F28386S , TMS320F28386S-Q1 , TMS320F28388D , TMS320F28388S , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
In the given example code, it provides a showcase to use a GPIO signal, to simulate the external comparator output state, as the system trip source signal. In F28004x, the on-chip signal crossbars (X-bars), including Input X-BAR and the EPWM X-BAR mechanism, make it possible to route any GPIO signal to work as the any of the eight dedicated EPWM TRIPx signals.
The following codes, found in InitINPUTXBAR() and InitEPWMXBAR(), show that GPIO14, referring to EPWM8A, is set as the source for XBAR_INPUT_system (INPUT X-BAR 1), and then fed to XBAR_TRIP_system (EPWM X-BAR TRIP4). For more details, see the EPWM X-BAR Mux Configuration table in the TMS320F28004x Piccolo Microcontrollers Technical Reference Manual.
// INPUT X-BAR 1 GPIO14 EPWM8A
XBAR_setInputPin(XBAR_INPUT_system, simulate_PWM_GPIO);
XBAR_setEPWMMuxConfig(XBAR_TRIP_system, XBAR_EPWM_MUX01_INPUTXBAR1);
XBAR_enableEPWMMux(XBAR_TRIP_system, XBAR_MUX01);
Note that the trip source can also be flexibly selected from the internal comparator output. For example, using the output CTRIPH of CMPSS1 as the X-BAR_TRIP_system is shown as below:
XBAR_setEPWMMuxConfig(XBAR_INPUT_system, XBAR_EPWM_MUX00_CMPSS1_CTRIPH);
XBAR_enableEPWMMux(XBAR_TRIP4, XBAR_MUX00);
Besides, in order to implement the protection logic, an extra EPWM channel (EPWM7A used in the example) is also required to set as the auxiliary trip source signal, where EPWM7A is configured as XBAR_TRIP_auxiliary (EPWM X-BAR TRIP7).
// INPUT X-BAR 3->GPIO12->EPWM7A
XBAR_setInputPin(XBAR_INPUT_auxiliary, AUX_PWM_GPIO);
XBAR_setEPWMMuxConfig(XBAR_TRIP_auxiliary, XBAR_EPWM_MUX05_INPUTXBAR3);
XBAR_enableEPWMMux(XBAR_TRIP_auxiliary, XBAR_MUX05);