Also as mentioned in the above code snippet from motor solution in order to make all the pwms syncronized to EPWM1, syncin for different PWMs should be configured correctly as per the sync scheme mentioned above. The TBPHS value should be configured as per TBCLK configuration. Refer to below description from TRM for TBPHS specific calculation. Each ePWM module can be configured to use or ignore the synchronization input. If the TBCTL[PHSEN] bit is set, then the time-base counter (TBCTR) of the ePWM module will be automatically loaded with the phase register (TBPHS) contents when one of the following conditions occur: . EPWMxSYNCI: Synchronization Input Pulse: The value of the phase register is loaded into the counter register when an input synchronization pulse is detected (TBPHS ¨ TBCTR). This operation occurs on the next valid time-base clock (TBCLK) edge. The delay from internal master module to slave modules is given by: . if ( TBCLK = EPWMCLK): 2 x EPWMCLK . if ( TBCLK != EPWMCLK):1 TBCLK
↧