2740 views|9 replies

2870

Posts

4

Resources
The OP
 

Can the same timer realize two independent PWM pulses? [Copy link]

Currently, I want to use one timer to achieve two PWM outputs. The two PWM outputs have the same period, different phases (and can be adjusted), and the same pulse width. It is best to have PWM outputs with different pulse widths. The microcontroller used is GD32F103C8T6.

I would like to ask an expert whether it is possible to use the same timer but different channels to achieve two PWM outputs.

This post is from MCU

Latest reply

Some chips can add a delay period, and a timer can output several channels   Details Published on 2022-7-29 15:43
 

6788

Posts

2

Resources
2
 

It is actually difficult to achieve different phases. My idea is to start the PWM output at different times to achieve different phases, but the phase difference is definitely inaccurate.

This post is from MCU

Comments

I don't have much idea, that is, when starting the first PWM, start the timer, and start the second PWM in the timer interrupt. My problem is that I need three timers. The timer in my board also has a pulse capture function, which also requires 2 timers, so I want to ask if PWM with the same period is possible.  Details Published on 2022-7-23 08:57
 
 

1792

Posts

0

Resources
3
 

I also want to know more about this aspect. The motor control of the massager seems to be like this. I wonder if it requires specific MCU support.

This post is from MCU
 
 
 

6075

Posts

6

Resources
4
 

The question is, is your phase adjustable and precise?

This post is from MCU
 
 
 

2870

Posts

4

Resources
5
 
wangerxian posted on 2022-7-22 15:28 It is actually difficult to achieve different phases. My idea is to turn on the PWM output at different times to achieve different phases, but this phase difference is definitely not accurate...

I have a few ideas, that is, when starting the first PWM, start the timer, and start the second PWM in the timer interrupt. My problem is that I need three timers. The timer in my board also has a pulse capture function, which also requires two timers. So I want to ask if PWM with the same period can use one timer, so as to save a timer. Otherwise, I need to replace the chip with more timers.

This post is from MCU

Comments

There is another way, which is to use a timer to generate the interrupt with the maximum resolution of the desired PWM, and then both PWMs are controlled in the timer interrupt. However, there are disadvantages, that is, the accuracy will be poor, and sometimes the interrupt priority will be preempted by other interrupts.  Details Published on 2022-7-24 10:19
 
 
 

6788

Posts

2

Resources
6
 
bigbat posted on 2022-7-23 08:57 I don't have much ideas. When starting the first PWM, start the timer, and start the second PWM in the timer interrupt. My problem is that I need to...

There is another way, which is to use a timer to generate the interrupt with the maximum resolution of the desired PWM, and then both PWMs are controlled in the timer interrupt. However, there are disadvantages, that is, the accuracy will be poor, and sometimes the interrupt priority will be preempted by other interrupts.

This post is from MCU
 
 
 

4771

Posts

12

Resources
7
 

Is it possible to divide the reference crystal frequency?

This post is from MCU

Comments

This has nothing to do with the crystal oscillator. I am just asking if it is possible to use one timer to generate two PWMs and save one timer. This project can be realized by using three timers. But I only want to use two.  Details Published on 2022-7-25 08:49
 
 
 

2870

Posts

4

Resources
8
 
Azuma Simeng published on 2022-7-24 16:18 Is it possible to divide the frequency of the reference crystal oscillator?

This has nothing to do with the crystal oscillator. I am just asking if it is possible to use one timer to generate two PWMs and save one timer. This project can be realized by using three timers. But I only want to use two.

This post is from MCU
 
 
 

4005

Posts

0

Resources
9
 

If software is involved, anything can be done, but the target cannot be high.

Only one of the phase and duty cycle can be changed. If both are changed together, the period must be different.

This post is from MCU
 
 
 

17

Posts

0

Resources
10
 

Some chips can add a delay period, and a timer can output several channels

This post is from MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list