cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Shifted PWM error STM32F0

quintanabarcia.pablo
Associate II

Hi,

I am currently working with an STM32F0 Discovery Board (with CubeMX and HAL). I am trying to shift two PWMs.

The first thing I tried was to program TIM1 and TIM3 as follows:

0690X000006DZ5kQAG.jpg

Channel 1 of TIM 1 is the trigger of the TIM3 PWM and the configuration of this last timer is:

0690X000006DZ5pQAG.jpg

It is rather simple but it works perfectly. I just calculated the pulse_length of the TIM 1- CH1 to have a 10us phase shift between TIM1-CH2 and TIM3-CH1.

0690X000006DZ6EQAW.jpg

However, I tried to do the same thing with TIM15 (because it has CH1 and CH1N PWM generation).

0690X000006DZ5zQAG.jpg

And it does not work like the previous case. The time-shift between TIM1-CH2 and TIM15-CH1 does not match with the programmed value.

0690X000006DZ6TQAW.jpg

Now, the interesting part. Since TIM15 did not work, I programmed TIM2 as well just to check if the GPIO port related to TIM15 was burned or something. Well, if you program TIM2-CH1 as a PWM output, then TIM15-CH1 begins to work properly with a 10us shifted value, as programmed. I do not need to start the channel of TIM2. Just configurate TIM2.

Any clue? Could be a HAL/CubeMX problem?

1 ACCEPTED SOLUTION

Accepted Solutions
quintanabarcia.pablo
Associate II

I figured it out!!

The problem is that TIM 1 cannot be master of TIM15.0690X000006DZ9NQAW.jpg

Thanks and I hope this would be helpful for other users.

View solution in original post

1 REPLY 1
quintanabarcia.pablo
Associate II

I figured it out!!

The problem is that TIM 1 cannot be master of TIM15.0690X000006DZ9NQAW.jpg

Thanks and I hope this would be helpful for other users.