Skip to main content
Graham1904
Associate III
November 7, 2020
Question

Is there anyway I can configure the STM32L476 to get a PWM waveform such as is shown in the jpg file attached? I have tried complimentary and TIMx-CH1N is exactly the opposite of TIMx-CH1. Adjustable DutyCycle with DeadTime.

  • November 7, 2020
  • 7 replies
  • 2275 views

..

This topic has been closed for replies.

7 replies

TDK
November 7, 2020

You should be able to do this with a single timer on CH1 and CH1N channels. Set it for 50% duty cycle and adjust the dead-time to give you different duty cycles. With zero dead time, the channels are opposite, but with nonzero dead time they will be different.

0693W000005Ah0EQAS.png

"If you feel a post has answered your question, please click ""Accept as Solution""."
Graham1904
Associate III
November 9, 2020

Thank you for your answer but if setup the PWM as you suggest I still get the complementary and not the push-pull output that I require:

0693W000005AgNWQA0.jpg

waclawek.jan
Super User
November 9, 2020

Which STM32?

What are the timing requirements?

Did you try to set deadtime in TIM_BDTR?

JW

Graham1904
Associate III
November 9, 2020

STM32L476.

25KHz PWM with a variable (internally defined) D/C.

Setting D/C to 1.5uS (120 clock cycles) or leaving it at zero has no effect on the output waveform. It defaults as "complementary"

waclawek.jan
Super User
November 9, 2020

I don't know what is D/C.

If you have a 40us period waveform and observing it with LA or oscilloscope you don't see a 1.5us deadtime between the two waveforms, you have set something incorrectly. Read out and post the timer registers.

You may also describe your timing requirements in more depth. What should be the exact relationship between the two waveforms, what is fixed and what is required to be variable?

In the 'L4, timers already have Combined PWM mode, where output is generated as AND or OR of two adjacent channels, That's useful to generate phase-shifted pulses within one timer, and that is maybe what you need here. Read the TIM chapter in RM.

JW

Graham1904
Associate III
November 10, 2020

D/C is Duty Cycle. It is expressed in percent.

I want to change the D/C depending on the MPPT point of a 375watt 90Vdc solar panel array feeding a load via a PCB with a full H-Bridge at a frequency of 25KHz.

My system will start off with a low value of D/C, say 5%, and increase the D/C until the MPPT point of the incoming solar array is reached.

I realise that there will be no D/T viewed if the D/C is low as electrically they is no need for it. Approaching the 50% mark the D/T should become visible as per image0693W000005AtE8QAK.jpg.

waclawek.jan
Super User
November 10, 2020

This exactly is the purpose of deadtime insertion in the Advanced Timers (TIM1, TIM8).

If you don't see this, there's something wrong in the setup.

Read out and post the content of TIM1 registers.

JW

TDK
November 10, 2020

I'm as sure as I can be that this is possible with dead-time generation.

"If you feel a post has answered your question, please click ""Accept as Solution""."