How to put Delay or offset Between two PWM Pulse.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-17 5:49 AM
Hello Members,
I am new to STM32 MCUs. I am trying to generate PWM and try to modify on fly and it works. But my requirement is to have a delay between two pulse on time and it should not align to each other on any edge. Please see the photo to understand the expected output.
So requirement is, How to put Delay or offset Between two or multiple PWM Pulse?
MCU: STM32L476
STM32CubeIDE 1.8.0
Thanks
Bhavik
Solved! Go to Solution.
- Labels:
-
ADC
-
DMA
-
STM32CubeIDE
-
STM32L4 series
-
TIM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-17 6:10 AM
The most flexible way is to use combined PWM mode available on some timers. You need 2 timer channels per PWM. This allows you to set the offset for each of the 4 edges indivually. With CubeMX like:
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-17 6:07 AM
Read Combined PWM mode subchapter of TIM chapter.
You can't do this with any arbitrary channel, though.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-17 6:10 AM
The most flexible way is to use combined PWM mode available on some timers. You need 2 timer channels per PWM. This allows you to set the offset for each of the 4 edges indivually. With CubeMX like:
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-17 10:03 PM
@KnarfB​ Thanks for quick reply I tried the mentioned setting but It wont work.
As mentioned I am using STM32L476RG Nucleo Board for testing. Any Clue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-17 10:12 PM
I'm using Nulceo-STM32L432KC here, should be quite similar.
Did you start the PWM channels in the code:
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1 );
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2 );
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3 );
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_4 );
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-18 1:23 AM
@KnarfB​ I am doing that. But They pulse value calculation I am not doing correctly so it is not working.
I come to know how to do it and I am able to do it.
See the photo.
Thanks for your input.
Soon Will post my answer with all the details so it may useful to others.
