Skip to main content
Visitor II
March 25, 2020
Question

Doubts about the inconsistency of bit width between ll library and standard library timer input capture return value data

  • March 25, 2020
  • 2 replies
  • 861 views

Hello everyone, when debugging, we found that the input capture return value of ll library is different from that of standard library. Ll library forces the return value to 32-bit, which is originally only 16 bit, as mentioned above

Capturedvalue (between min? Data = 0 and max? Data = 65535), but it's still 32-bit. If you don't understand, the standard library doesn't have this way, and it returns directly,

LL Library

0693W000000UfbXQAS.png

Standard library

0693W000000UfbwQAC.png

I hope you can help me, thank you!

    This topic has been closed for replies.

    2 replies

    Super User
    March 25, 2020

    It should be 32 bits, otherwise 32-bit timers are not going to return the correct value. If you want it as a uint16_t, just make it one.

    仕陈.1Author
    Visitor II
    March 25, 2020

    Oh, it's for compatibility, right? The maximum timer capture is uint16_t. I can convert it to uint16_t,thank you!

    Visitor II
    March 25, 2020

    At the time the standard peripheral library for the STM32F1 series was introduced, there were no STM32 MCUs with 32 bit timers.

    When ST has introduced HAL, there were already some MCUs with 32 bit timers around.