Skip to main content
Associate II
May 6, 2024
Solved

Query regarding HAL_GetTick() - what happens when SysTick timer rolls over through zero?

Hi - I'm using HAL_GetTick(), and then subtracting one value from another to determine a GPIO input pulse width.

What happens if I happen to to call HAL_GetTick() around the point where the SysTick timer rolls over through zero.

Do I need to watch out for this situation generally?

Regards, John.

This topic has been closed for replies.
Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
May 6, 2024

Yes, you have to consider this problem. Typically, this is only used to determine time differences to a previously saved value, which eliminates the problem, as discussed here, for example.

Hope that helps?

Regards
/Peter

In order 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.

2 replies

Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
May 6, 2024

Yes, you have to consider this problem. Typically, this is only used to determine time differences to a previously saved value, which eliminates the problem, as discussed here, for example.

Hope that helps?

Regards
/Peter

In order 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.
John123Author
Associate II
May 6, 2024

Many thanks.