cancel
Showing results for 
Search instead for 
Did you mean: 

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

仕陈.1
Associate

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!

3 REPLIES 3
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".

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

berendi
Principal

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.