cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate 2 sync square signals with timers

DAlvarez
Associate II

I would appreciate if someone could provide me with some tips about how to accomplish this in an optimal way.

I want to generate a square signal in one pin, and exactly the double in other, both must be synchronized.

My first approach was to use one timer with 2 outputs in output compare and "toggle on mach" but both signals have the same frequency, and I only can change the phase with the "pulse" register

As this timers have 4 channels I was thinking in using 1 channel to generate a base signal, and the other channels to toggle the output pin each n number of counts, but I don't know how to do that.

BTW this is a generic question about timers, but I'm working with a Nucleo F722, using CubeIDE 1.7.0 and the HAL libraries.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

You can do this by setting one channel with 50% PWM and the other channel with toggle on match. I've done it.

Print out relevant TIM registers if this isn't working for you.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

You can do this by setting one channel with 50% PWM and the other channel with toggle on match. I've done it.

Print out relevant TIM registers if this isn't working for you.

If you feel a post has answered your question, please click "Accept as Solution".
DAlvarez
Associate II

Done it, and works for me. Thanks!