Skip to main content
Associate II
October 5, 2026
Question

STM32F072RBT6 TIM1 Complementary PWM – 20 kHz, 50% Duty and 500 ns Dead Time Not Working as Expected

Hello ST Community,

I am working with an STM32F072RBT6 NUCLEO board and I am trying to generate
3-phase complementary PWM using TIM1.

My requirement is:

• MCU: STM32F072RBT6
• Board: NUCLEO-F072RB
• Timer: TIM1
• System Clock: 48 MHz
• TIM1 Clock: 48 MHz
• PWM Frequency: 20 kHz
• Duty Cycle: 50%
• Complementary PWM: CH1/CH1N, CH2/CH2N, CH3/CH3N
• Required Dead Time: 500 ns

My TIM1 configuration is:

Prescaler = 0
Counter Mode = Up
ARR = 2399
Clock Division = DIV1
CCR1 = 1200
CCR2 = 1200
CCR3 = 1200

PWM frequency calculation:

PWM = 48 MHz / (PSC + 1) / (ARR + 1)

PWM = 48,000,000 / 1 / 2400

PWM = 20 kHz

For the dead time:

TIM1 clock = 48 MHz

1 timer tick = 20.833 ns

Required dead time = 500 ns

500 ns / 20.833 ns ≈ 24

Therefore I configured:

DeadTime = 24

My output pins are:

TIM1_CH1  -> PA8
TIM1_CH1N -> PB13

TIM1_CH2  -> PA9
TIM1_CH2N -> PB14

TIM1_CH3  -> PA10
TIM1_CH3N -> PB15


The problem is with the complementary outputs.

For example, when monitoring PA8 (CH1) and PB13 (CH1N) on an oscilloscope:

• When PA8 is HIGH, PB13 is LOW.
• When PA8 goes LOW, PB13 goes HIGH.
• However, I am not consistently able to observe the expected 500 ns
  dead-time interval at every transition.
• Some transitions appear to have the expected dead time, while other
  transitions appear different.

I am also unsure whether my TIM1 BDTR/dead-time configuration is correct
for the STM32F072RBT6.

My relevant configuration is:

sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 1200;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;

sBreakDeadTimeConfig.DeadTime = 24;
sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE;
sBreakDeadTimeConfig.AutomaticOutput =
    TIM_AUTOMATICOUTPUT_DISABLE;


I would like to confirm:

1. Is DeadTime = 24 correct for obtaining 500 ns dead time
   with a 48 MHz TIM1 clock on STM32F072?

2. Is ARR = 2399 and PSC = 0 the correct configuration for exactly
   20 kHz PWM?

3. Is PWM Mode 1 with OCPolarity = HIGH and OCNPolarity = HIGH
   correct for complementary PWM?

4. Is there any additional TIM1 BDTR/MOE configuration required on
   STM32F072 for CHx/CHxN complementary PWM?

5. Is there any recommended configuration in STM32CubeMX for this
   application?

6. Could there be a GPIO Alternate Function or output configuration
   issue causing the observed waveform?

I would appreciate any guidance regarding the correct TIM1 configuration
and how to reliably obtain 500 ns dead time on all complementary PWM
transitions.

Thank you.

7 replies

AScha.3
Super User
October 5, 2026

Hi,

>1. Is DeadTime = 24 correct

ok, at 48M, CKD = 0 , 24 x 20.8 ns = 499 ns

>3. Is PWM Mode 1

is what you want - ok.

>4. Is there any additional TIM1 

seems ok

>5 recommended configuration 

you have to know, what you want

>6 Could there be ...   issue causing the observed waveform

The waveform looks ok for me, just your measurement is not ok: unloaded output...gives a mix of switching and charged voltage; check your TIM signals at the cpu pins (and scope probe calibrated for square wave and 10:1 setting);

then you will see exactly 500ns dead times.

 

ex. see in your last pic:

 

If you feel a post has answered your question, please click on " Best Answer ".
PANDI902Author
Associate II
October 6, 2026

Hi,

Thank you for your detailed response and for confirming that DeadTime = 24 is correct for 500 ns at a 48 MHz TIM1 clock.

I understand your point that the waveform measurement may be affected by the unloaded output and that I should verify the TIM1 signals directly at the CPU pins.

I will check the following:

  • PA8 / PB13 – TIM1 CH1 / CH1N
  • PA9 / PB14 – TIM1 CH2 / CH2N
  • PA10 / PB15 – TIM1 CH3 / CH3N
  • Use a 10:1 oscilloscope probe
  • Calibrate the probe using the oscilloscope's square-wave calibration output
  • Measure the complementary signals directly at the MCU pins
  • Check the dead time at both rising/falling transitions using the oscilloscope cursors

I will repeat the measurement at the CPU pins and verify whether I can observe the expected ~500 ns dead time.

If I still cannot observe the 500 ns dead time directly at the MCU pins, I will share the new oscilloscope waveform and configuration for further review.

Thank you for your guidance and support.

Best Regards,
Veerapandiyan V

PANDI902Author
Associate II
October 7, 2026

Hi ST Team,
I am waiting for your reply.
Regards,
Veerapandiyan V

AScha.3
Super User
October 7, 2026

>I will repeat the measurement at the CPU pins and verify whether I can observe the expected ~500 ns dead time.

I am still waiting for a useful measurement.

This :

..is just a joke. At 500ks (= 2 us sampling steps)  to “prove” a delay in the xx - ns range is just nonsense.

Do a meaningful measurement .

Or ask for help, how to setup a scope and learn, how to do it.

If you feel a post has answered your question, please click on " Best Answer ".
PANDI902Author
Associate II
October 7, 2026

Hi,

We are also expecting the same result. Even after performing the dead-time calculation correctly and applying the calculated value, we are still not able to observe the expected 500 ns dead time in the waveform.

Regarding the oscilloscope measurement, we understand and are already familiar with using the oscilloscope, probe calibration, 10:1 probe setting, and cursor measurements.

However, our main concern is this: if the dead-time interval is not clearly visible in the waveform, how can we accurately place the oscilloscope cursors at the beginning and end of the dead-time period?

We have checked all three complementary PWM pairs:

  • PA8 / PB13 – TIM1 CH1 / CH1N
  • PA9 / PB14 – TIM1 CH2 / CH2N
  • PA10 / PB15 – TIM1 CH3 / CH3N

We are observing the same behavior on all three pairs.

We have already verified the following:

  • TIM1 clock = 48 MHz
  • PWM frequency = 20 kHz
  • PWM Mode = PWM Mode 1
  • CKD = DIV1
  • DeadTime = 24, corresponding to approximately 500 ns
  • Complementary outputs are enabled correctly

We would really appreciate your support in helping us identify whether there is any additional TIM1 configuration, GPIO configuration, or hardware-related setting that could prevent the expected dead time from appearing at the MCU pins.

We would be very happy if you could guide us step-by-step to obtain and verify both the expected 20 kHz PWM frequency and the 500 ns dead time.

Thank you for your time and support.

Best Regards,
Veerapandiyan V

 

Andrew Neil
Super User
October 7, 2026

As ​@AScha.3 said, you cannot expect to accurately capture something on the order of 500 nanoseconds when your sampling interval is only 2 microseconds !

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
AScha.3
Super User
October 7, 2026

>However, our main concern is this: if the dead-time interval is not clearly visible in the waveform,

This is about : how to set your scope/DSO , not about the cpu or the TIM output.

In your first pics there was a better setting of your DSO: (50MS/s , about 20ns resolution possible)

So try to capture a more useful shot , maybe use single shot mode and appropriate horiz./time setting, maybe 2us/div .

Then show pic/result with the 2 channels, triggered on 1.

btw the micsig is this: ?  (max. 1 GS/s ! )

 

If you feel a post has answered your question, please click on " Best Answer ".