Setupข้างล่างคือ the clock setup สำหรับ the project.

ที่นี่ทั้งสอง the APB Timer clocks รันที่ 90 MHz. เราจะใช้ the timers 1, 2 and 3 เพื่อสร้าง the 3 PWM signals. ที่นี่ TIM1 ถูกต่อกับ the APB2 bus และ TIM2 and 3 ถูกต่อกับ the APB1 bus. ผมจะเก็บ the clock ให้เท่ากันสำหรับ buses เหล่านี้ดังนั้นเราสามารถใช้การกำหนดค่าเดียวกันสำหรับ the timers.
The internal Trigger system สำหรับ Timers เหล่านี้ถูกแสดงไว้ข้างล่าง

ที่นี่ คุณจะเห็น the TIM2 เป็น a slave สามารถถูกควบคุมโดย the master TIM1 โดยใช้ the ITR0 signal. ในทำนองเดียวกัน, the TIM3 สามารถถูกควบคุมโดย the TIM2 โดยใช้ the ITR1 signal.
เราจะใช้สัญญานเหล่านี้เพื่อทริก the counter ของ the slave Timers, เมื่อ the master counter ถึงค่าที่กำหนดไว้ล่วงหน้า.

• โดยพื้นฐานแล้ว the TIM1 จะสร้าง a PWM signal บน channel 1
• เมื่อ the counter 1 จะถึง 33% ของ the ARR value, TIM1 Output Compare บน channel 2 จะไปเป็น high.
• นี้จะทริก the ITR0 signal, และ TIM2’s counter จะสตาร์ทในตอนนั้น.
• ในทำนองเดียวกัน, เมื่อ the counter 2 จะถึง 33% ของ the ARR value, TIM2 Output compare บน channel 2 จะไปเป็น
high และจะทริก the ITR1 signal.
• TIM3 counter จะสตาร์ทในตอนนั้น.