Skip to main content
Associate
October 10, 2026
Solved

DTR2-DTGF ignored!

STM32CubeMX 6.18.1 + STM32Cube FW_G4 1.28.3
Target: STSPIN32G4 / TIM1
Asymmetrical Dead Time enabled

CubeMX GUI:

  • Dead Time = 50
  • Falling Dead Time = 50
  • Asymmetrical Dead Time = Enable

Generated LL code:

C

 

 

TIM_BDTRInitStruct.DeadTime = 50;

No write to TIM1->DTR2 is generated.

Runtime observation:

  • DTAE = 1
  • DTGF = 0

Therefore CubeMX appears to generate DTAE but not DTGF.

bsfrn1344Best answer
Associate
October 13, 2026

The problem has been solved.

Initially, CubeMX was configured with:

  • Dead Time = 50
  • Asymmetrical Dead Time = Enabled
  • Falling Dead Time = 50

However, when I inspected the TIM1 registers, I found:

Plain Text

 

 

DTAE = 1

DTGF = 0

This indicated that the asymmetrical dead-time mode was enabled, but the falling dead-time value was not actually loaded into the DTGF field of the DTR2 register.

While investigating, I changed the Falling Dead Time parameter in CubeMX from a numeric value to a user-defined constant:

C

 

 

#define DEADTIME_FALL 50

After regenerating the code, CubeMX generated:

C

 

 

LL_TIM_SetFallingDeadTime(TIM1, DEADTIME_FALL);

Unexpectedly, after changing the parameter back to the numeric value and regenerating again, everything continued to work correctly.

The final register contents became:

Plain Text

 

 

DTAE = 1

DTGF = 50 (0x32)

and the generated code correctly initializes the falling dead time.

So the issue was not a hardware problem. Most likely CubeMX had an internal configuration/code-generation inconsistency that was resolved after forcing a regeneration by temporarily using a symbolic constant.

Final status:

Plain Text

 

 

Asymmetrical Dead Time: Enabled

Rising Dead Time: 50

Falling Dead Time: 50

DTAE = 1

DTGF = 50

The TIM1 dead-time configuration is now working as expected.

3 replies

GMA
ST Technical Moderator
October 12, 2026

Hello ​@bsfrn1344,

The post was moved to the STM32 MCUs Embedded software topic because it is not related to MCSDK.

If you agree with the answer, please accept it by clicking on 'Best answer'.Best regards.GMA
Ghofrane GSOURI
ST Technical Moderator
October 13, 2026

Hello ​@bsfrn1344 

Could you please provide your IOC?

THX,

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
bsfrn1344AuthorBest answer
Associate
October 13, 2026

The problem has been solved.

Initially, CubeMX was configured with:

  • Dead Time = 50
  • Asymmetrical Dead Time = Enabled
  • Falling Dead Time = 50

However, when I inspected the TIM1 registers, I found:

Plain Text

 

 

DTAE = 1

DTGF = 0

This indicated that the asymmetrical dead-time mode was enabled, but the falling dead-time value was not actually loaded into the DTGF field of the DTR2 register.

While investigating, I changed the Falling Dead Time parameter in CubeMX from a numeric value to a user-defined constant:

C

 

 

#define DEADTIME_FALL 50

After regenerating the code, CubeMX generated:

C

 

 

LL_TIM_SetFallingDeadTime(TIM1, DEADTIME_FALL);

Unexpectedly, after changing the parameter back to the numeric value and regenerating again, everything continued to work correctly.

The final register contents became:

Plain Text

 

 

DTAE = 1

DTGF = 50 (0x32)

and the generated code correctly initializes the falling dead time.

So the issue was not a hardware problem. Most likely CubeMX had an internal configuration/code-generation inconsistency that was resolved after forcing a regeneration by temporarily using a symbolic constant.

Final status:

Plain Text

 

 

Asymmetrical Dead Time: Enabled

Rising Dead Time: 50

Falling Dead Time: 50

DTAE = 1

DTGF = 50

The TIM1 dead-time configuration is now working as expected.