Part Number: TMS320F280039C
Other Parts Discussed in Thread: SYSCONFIG
I used sysconfig and enabled TBCLKSYNC in the SYSCTL section. I expected this to synchronize the PWMs but it did not. The problem is that in the generated board.c file, the SYSCTL configuration happens BEFORE the EPWM configuration. In the documentation (which is apparently correct) the TBCLKSYNC must be disabled while the EPWMs are configured and then enabled after the configuration. When you use Sysconfig, this does not happen so the EPWMs are not synchronized. It took a long time to figure that out!
I fixed the problem by disabling the TBCLKSYNC in the SYSCTL and used the following code:
Board_init(); // // To synchronize the PWM units you MUST disable TBCLKSYNC in the SYSCTL section of Sysconfig // Then the PWMs get configured in Board_init() // Now we must enable TBCLKSYNC below. // Enable sync and clock to PWM // SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
I think this is a bug in SYSCONFIG. If not, it should be easier to find the issue. I even tried this code from the example code but it fails to do anything if TBCLKSYNC is already on in SYSCONFIG -- it breaks the example.
// Disable sync(Freeze clock to PWM as well). GTBCLKSYNC is applicable
// only for multiple core devices. Uncomment the below statement if
// applicable.
//
// SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_GTBCLKSYNC);
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
//
// Configure GPIO0/1 , GPIO2/3 and GPIO4/5 and GPIO6/7 as
// ePWM1A/1B, ePWM2A/2B, ePWM3A/3B, ePWM4A/4B pins respectively
// Configure EPWM Modules
//
Board_init();
//
// Enable sync and clock to PWM
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
Regards