cancel
Showing results for 
Search instead for 
Did you mean: 

A possible bug in PWM HAL drivers

hesam moshiri
Associate III
Posted on July 05, 2018 at 18:47

Hi,

I just generated two identical PWN pulses using two separated identical timers in the STM32F407 chip. After the MCU resets or a momnet after the MCU startup, both PWM pulses overlap each other as naturally should be (First picture).

But as time passes (few seconds) one of the pulses starts to make phase shift (Second picture). After the MCU reset, both pulses come together and overlap again.

It is weird isn't it?!!!! This could be a bug in the HAL drivers. I have used  HAL_TIM_PWM_Start() for the both timers

as I mentioned everything on both timers are identical which also leads to an identical frequency. Therefore the reason of this gradual phase shift must be investigated.

0690X00000604fEQAQ.jpg0690X00000604jsQAA.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on July 05, 2018 at 22:01

Alright. I re-checked again and I confirm that a very small difference was causing this. I had a great doubt also because it is very unlikely for the HAL to contain such bugs and that was the reason I mentioned a possible bug.

View solution in original post

4 REPLIES 4
Posted on July 05, 2018 at 21:25

Try change oscilloscope

henry.dick
Senior II
Posted on July 05, 2018 at 21:32

'

as I mentioned everything on both timers are identical which also leads to an identical frequency.'

maybe to you but not to us.

you said that both timers are identically programmed - you didn't show that;

you hoped that both timers are identically configured - you didn't show that;

unless you can show identical register values, we cannot be sure that both timers are identical.

Posted on July 05, 2018 at 21:46

Oscilloscope does not have any problem. I have a function generator either and I can confirm that oscilloscope is healthy. 

:)

Posted on July 05, 2018 at 22:01

Alright. I re-checked again and I confirm that a very small difference was causing this. I had a great doubt also because it is very unlikely for the HAL to contain such bugs and that was the reason I mentioned a possible bug.