SPRUHJ1I January 2013 – October 2021 TMS320F2802-Q1 , TMS320F28026-Q1 , TMS320F28026F , TMS320F28027-Q1 , TMS320F28027F , TMS320F28027F-Q1 , TMS320F28052-Q1 , TMS320F28052F , TMS320F28052F-Q1 , TMS320F28052M , TMS320F28052M-Q1 , TMS320F28054-Q1 , TMS320F28054F , TMS320F28054F-Q1 , TMS320F28054M , TMS320F28054M-Q1 , TMS320F2806-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28068F , TMS320F28068M , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M-Q1
Figure 6-13 represents a configuration of the PWM pins, where phase A of the motor is driven by EPWM1A/EPWM1B, motor phase B by EPWM2A/EPWM2B, and motor phase C by EPWM3A/EPWM3B. This configuration in hardware is the same as the DRV8312 Revision D board, and it is taken as an example in this document.
For more details about the EPWM configuration, see the TMS320x2806x Technical Reference Guide, the TMS320x2805x Technical Reference Guide, and the TMS320F2802x, TMS320F2802xx System Control and Interrupts Reference Guide. For more details about pins related to specific packages, see the TMS320F2806x Microcontrollers Data Sheet, the TMS320F2805x Microcontrollers Data Sheet, and the TMS320F2802x, TMS320F2802xx Microcontrollers Data Sheet.
The following code example shows how to setup the PWM pins for the diagram shown above. This code example is part of the initialization of the driver object (HAL_init), contained in hal.c file. Once the handles are initialized to use the first three EPWM pairs, the rest of the PWM configuration is done to the initialized handles:
// initialize PWM handle
obj->pwmHandle[0] = PWM_init((void *)PWM_ePWM1_BASE_ADDR,sizeof(PWM_Obj));
obj->pwmHandle[1] = PWM_init((void *)PWM_ePWM2_BASE_ADDR,sizeof(PWM_Obj));
obj->pwmHandle[2] = PWM_init((void *)PWM_ePWM3_BASE_ADDR,sizeof(PWM_Obj));
The highlighted text indicates the correspondence between: