I've fiddled for a few hours but I am stuck. The documentation is a bit "light" on syncing and I'm unable to find any v2 examples. I don't believe the code below is doing anything
Three outputs on
Code: Select all
mcpwm_config_t pwm_config;
pwm_config.frequency = PULSE_FREQUENCY;
pwm_config.cmpr_a = 50.0;
pwm_config.cmpr_b = 50.0;
pwm_config.counter_mode = MCPWM_UP_COUNTER;
pwm_config.duty_mode = MCPWM_DUTY_MODE_0;
mcpwm_init(MCPWM_UNIT_0, MCPWM_TIMER_0, &pwm_config);
pwm_config.cmpr_a = 5.0;
mcpwm_init(MCPWM_UNIT_0, MCPWM_TIMER_1, &pwm_config);
mcpwm_init(MCPWM_UNIT_0, MCPWM_TIMER_2, &pwm_config);
mcpwm_sync_config_t sync_config;
sync_config.sync_sig = MCPWM_SELECT_TIMER0_SYNC;
sync_config.timer_val = 0;
sync_config.count_direction = MCPWM_TIMER_DIRECTION_UP;
mcpwm_sync_configure(MCPWM_UNIT_0,MCPWM_TIMER_1, &sync_config);
mcpwm_sync_configure(MCPWM_UNIT_0,MCPWM_TIMER_2, &sync_config);
MCPWM0.timer[1].timer_sync.timer_synci_en = 1;
delayMicroseconds(1000);
MCPWM0.timer[1].timer_sync.timer_synci_en = 0;
MCPWM0.timer[2].timer_sync.timer_synci_en = 1;
delayMicroseconds(1000);
MCPWM0.timer[2].timer_sync.timer_synci_en = 0;
Also, changing the value of
Code: Select all
sync_config.timer_val = 0;
So, has anyone any ideas on why nothing is syncing?
Thanks