How to resolve the PWM output malfunction I am encountering in STM32F446RE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-19 4:07 AM
I am trying to generate 4 channel signals using Timer 1 (due to the need of Dead Time) and am facing a problem with the output. Even after defining the timer output compare polarity and all, sometimes the signal just dephases (or in other words shifts) forward which causes the whole signal to either vanish (like in case of “a�? and “b�? where they cancel each other) or create a totally different signal (like in the case of “A�? and “B�?). N.B: in the photos below, a/A are what the signals should look like and b/B are the dephased ones that are causing the malfunctions in the final output signal.
Thank you previously for your reply,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-19 8:44 AM
What are those waveforms coming from? What do you do in the program?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-20 3:52 AM
First of all I would like to thank you for your reply.
What I am doing in the program is Generate 4 PWM signals using Channel 1, Channel1N, Channel 2, and Channel 2N. The purpose is to control an Full bridge inverter, where those 4 signals are connected to the 4 MOSFETs, Hence the need of Timer 1's Dead time register, resulting in the creation of an Alternative signal. But when I start to add the dephase to the pulse formula, in the purpose of manipulating the slop of the output signal, Channel 2 signal just starts to change its polarity, as seen in the photo I posted, which has catastrophic effect on the output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-20 12:45 PM
> Generate 4 PWM signals using Channel 1, Channel1N, Channel 2, and Channel 2N.
Of the same TIM1? And which color is which? How do you achieve the phase difference? Do you use PWM mode, or Toggle mode? What STM32 are we talking about?
> But when I start to add the dephase to the pulse formula,
What does this mean, in terms of TIM 1 register values?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-21 2:27 AM
Yellow: Channel 1
Blue: Channel 1N
Green: Channel 2
Violet: Channel 2N
I use the same Tim1, OC Toggle mode, STM32F446RE...As for the Phase difference, I add the dephase value at the end of the CCR calculation formula:
unsigned short compare_ch2_value = (uint32_t) ((period/8) + (period/2) + desfase) & 0xFFFF;
__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_2, (uint32_t) compare_ch2_value)
(in the photos, to achieve figure a, I added {-1} and to achieve A I added {0.75})
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-21 3:19 PM
Do you have the output compare preload enabled, i.e. TIMx_CCMRy.OCzPE=1?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-24 9:13 AM
Yup...Still facing the same problem
Mike
