STM32F4 - Timer Sync - Trigger Mode does not work
Hi,
I am having trouble to synchronize the start of two or more timers at the same time. Reading the manual, I figured out that, I have to select one timer as master timer with master configuration 'Enable' ('the counter enable signal is used as a trigger output (TRGO). It is used to start several timers at the same time, ...').
The slaves are configured in slave mode 'Trigger mode' ('the counter start at a rising edge of the trigger TRGI (but is not reset). Only the start of the counter is controlled.').
When I start the master timer with a delay, I expect the slave timer to start with the same delay. But the slave does start immediately. This is how my test code looks like:
HAL_TIM_OC_Start(&htim4, TIM_CHANNEL_2);
HAL_Delay(1000);
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_4);
My master/slave configuration for the timers looks like this:
void MX_TIM3_Init(void) {
....
sMasterConfig.MasterOutputTrigger = TIM_TRGO_ENABLE;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_ENABLE;
....
}
void MX_TIM4_Init(void) {
...
sSlaveConfig.SlaveMode = TIM_SLAVEMODE_TRIGGER;
sSlaveConfig.InputTrigger = TIM_TS_ITR2;
...
}
I am using CubeMX and a STM32F4 Discovery Board.
Thank you for any help. I have no idea what I am missing. I have read the manual several times, I have checked the internal trigger connections and I have also checked the CR2 and SMCR registers. #stm32f4 #timer-synchronization #timer-master-slave #timer-trigger