cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate PWM with offset / delay?

EAnde.3
Associate II

I need to generate two signals as shown below.

I need to be able to adjust A and B independently. Is there some way to use TIMER1's OC1 and OC2? I can't figure out how to make an offset in the output compares - everything seems to start at the main counter expiring. I also looked into feeding TIMER2 into TIMER1 but I didn't see a solution there either.

Any nudge in the correct direction would help me, thanks!

Erik0693W00000Dq2rmQAB.png

4 REPLIES 4
rpip.1
Associate III

Generally,you can use Asymmetric PWM mode of TIMER to generate this signal .

Thanks for the reply. I don't see an Asymmetric PWM mode in RM0016 manual, do you mean "center-aligned"? Center-aligned isn't quite what I want though.

Based on this MCU, I recommand to use TIM2 to trigger TIM1 to output. TIM2 output the signal you pictured above on TIM2 OC1. TIM2 OC1 is connected to TIM1 ETR to trigger TIM1 to output the signal you pictured below. And TIM1 worked on one-pulse mode and PWM mode 1. I'm not sure if you need to ouput these signal just on TIM1 OC1 and OC2.

EAnde.3
Associate II

Got it, I'll give it a shot and report back. thank you