Skip to main content
Visitor II
June 8, 2022
Solved

Bug in H7 hrtim deadtime prescaler reference manual RM0433 and the HAL library code

  • June 8, 2022
  • 3 replies
  • 1609 views

I was getting strange results with the deadtime prescaler of the H7 hrtim and it appears that the H7 reference manual (RM0433 rev 7) is incorrect: The DTPRSC field of register HRTIM_DTxR, is supposed to get binary values from 011 to 111 (000 to 010 are reserved) which correspond to multiplication of the  tHRTIM by 1, 2, 4, 8, and 16. The provided formula is tDTG = 2^(DTPRSC - 3) * tHRTIM.

But, when I set the prescaler to the HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL8 define from HAL, it places a 0 in DTPRSC, while according to RM0433, it should have been 0b110 (= 6). Then when I used HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL4, it wrote 1 in DTPRSC, and so on. There is not a XX_MUL16 defined.

The actual deadtime is scaling in the oposite direction! The delay with MUL8 is half of the delay with MUL4, which is half of that with MUL2, ....

Therefore the actual formula is tDTG = 2^(DTPRSC) * tHRTIM, so the -3 should not be in the exponent and the values of 0b000 to 0b010 are valid. (Probably the highest 3 values are the ones which should be reserved). Moreover, the names of the defines (the MUL4, MUL8, etc) in HAL are wrong.

Board: Nucleo H743ZI2, HAL version v1.10

    This topic has been closed for replies.
    Best answer by KDJEM.1

    Hello @AEfth​,

    This issue is fixed in STM32CubeH7 V.1.11.0.

    Thank you for your contribution in STCommunity.

    Kaouthar

    3 replies

    Technical Moderator
    June 27, 2022

    Hi @AEfth​ ,

    From my side, I think that following lines should be removed from HAL library code:

    HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL8

    HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL4

    HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL2

    Because the DTPRSC[2:0] values 000, 001, 010 are reserved.

    Therefore, have you checked these code lines:

    HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV1

    HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV2

    HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV4

    HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV8

    HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV16

    Kaouthar

    Technical Moderator
    July 7, 2022

    Hi @AEfth​ ,

    I reported the issue.

    Internal ticket number: 131444 (This is an internal tracking number and is not accessible or usable by customers).

    Kaouthar

    KDJEM.1Answer
    Technical Moderator
    December 30, 2022

    Hello @AEfth​,

    This issue is fixed in STM32CubeH7 V.1.11.0.

    Thank you for your contribution in STCommunity.

    Kaouthar