cancel
Showing results for 
Search instead for 
Did you mean: 

Connect TIMER2 to TIMER1

ee06091
Associate III
Posted on April 06, 2016 at 23:28

Hi,

The black waveform is the output of TIMER1, PWM mode on CH1. Now I want to start TIMER2 when there is match on TIMx_CCRx like the image below. I was trying to set up it on STM32CubeMx. I attached the project if you want to take a look into the STM32CubeMX 

https://my.st.com//public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Attachments/65036/timer.zip

 project. I'm trying to use the Master/Slave function of timers.

https://my.st.com//public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Attachments/65036/timers.png

#timer-synchronisation #pwm
1 REPLY 1
Walid FTITI_O
Senior II
Posted on April 07, 2016 at 15:13

Hi xavier.jose,

In your case, you want to synchronize both TIMER1 and TIMER2 to make the Timer2's counter start counting when TIMER1 CCR1 event occurs ( counter matches the compare value), you should proceed like follow:

Timer1 :

 

Master mode selected

Master Output trigger = OC1REF

(

OK in your code

)

Timer 2 :

 

Slave mode : trigger (

Ok in your code

)

The pulse values of both Timer shouldn't be reset, you should define the content of the TIMx_CCRx register to get the match like you want between CCRx and counter values.

(

not Ok in your code

)

-Hannibal-