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.

CCS/TMS320F280041C: InstaSPIN ePWM channel switch between A and B

Part Number: TMS320F280041C

Tool/software: Code Composer Studio

Greetings! I`m watching the InstaSPIN examples. In the hal.c file the HAL_setupPWMs function sets only channel A ->

// setup the Action-Qualifier Output A Register (AQCTLA)
EPWM_setActionQualifierAction(obj->pwmHandle[cnt],
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_HIGH,
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);

EPWM_setActionQualifierAction(obj->pwmHandle[cnt],
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_LOW,
EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);

and channel is forced high

// setup the Action-qualifier Continuous Software Force Register
// (AQCSFRC)
EPWM_setActionQualifierContSWForceAction(obj->pwmHandle[cnt],
EPWM_AQ_OUTPUT_B,
EPWM_AQ_SW_OUTPUT_HIGH);

I`ve noticed in the code is used function HAL_writePWMData(halHandle, &pwmData), but it doesn`t contain any code allowing a switch between A and B. Or I don`t know about it. So if I`m running a PWM on channel A and I need to switch to channel B what should I do? Where in the code is this done? And what value of pwmData registers such change? Because in the examples pwmData.Vabc_pu.value[0] = 0.0 should force  50% duty cycle. So I suppose negative value will drop the duty cycle below 50% and vice versa.

Thanks!

  • You don't see any channel B action qualifier configuration because the channels are configured for complementary mode using the dead band module. Please take a look at the Dead-Band section of the EPWM chapter of the technical reference manual.

    Are you trying to modify this code for different behavior or were you just trying to understand why the functions were implemented the way they were?

    Whitney