2026-03-12 6:20 AM
After updating the STM32CubeG4 Firmware Package from version 1.6.1 to 1.6.2, I discovered a bug that causes incorrect deadtime prescaler settings for HRTIM when using the LL driver and CubeMX. As a result, the deadtime value can change to a fraction of the original value without anyone noticing, which can lead to hardware damage.
If I set in STM32CubeMX 6.17.0:
HRTIM -> Timer x -> Dead Time -> Prescaler = "fDTG = fHRTIM * 2"
The generated code contains:
LL_HRTIM_DT_SetPrescaler(HRTIM1, LL_HRTIM_TIMER_x, LL_HRTIM_DT_PRESCALER_MUL2);
LL_HRTIM_DT_PRESCALER_MUL2 is defined as HRTIM_DTR_DTPRSC_2 -> Register HRTIM_DTxR DTPRSC[2:0] = 0x4
This results in the deadtime value:
t_DTG = 2^4 * (t_HRTIM / 8) = 2 * t_HRTIM = fHRTIM / 2
So instead of "fHRTIM * 2" I get "fHRTIM / 2"!
I think the confusion comes from the fact that in CubeMX the prescaler is set as a multiple of the frequency, but in the datasheet and driver the multiple of the period is described.
Before the driver update, there was an error in both CubeMX and the driver, which led to the correct settings.
In the mentioned update, the definitions of LL_HRTIM_DT_PRESCALER_ were modified/fixed.
Probably as a result of this report: STM32G4 HRTIM deadtime prescaler defines swapped
The Release Notes for STM32CubeG4 Firmware Package only mention "HAL HRTIM update, Fix HRTIM_Deadtime_Prescaler_Ratio macro definitions."
Solved! Go to Solution.
2026-03-16 4:06 AM
Hello @grmart
A ticket #0060562 has been escalated to dev team to make CubeMX describe DTPRSC primarily as a dead‑time time‑step (tDTG) multiplier, consistent with the RM:
I will keep you posted with updates.
THX
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.
2026-03-12 6:25 AM - edited 2026-03-13 5:00 AM
Hello @grmart
I'm currently checking this behavior. I will get back to you ASAP.
It would be useful if you could share 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.
2026-03-16 4:06 AM
Hello @grmart
A ticket #0060562 has been escalated to dev team to make CubeMX describe DTPRSC primarily as a dead‑time time‑step (tDTG) multiplier, consistent with the RM:
I will keep you posted with updates.
THX
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.