cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS equivalent of uint32_t HAL_GetTick(void)

harinath
Associate III
Posted on July 10, 2014 at 07:33

I'm using STM32Cube_FW_F4_V1.1.0 libraries for STM32F4. I found uint32_t HAL_GetTick(void) will provide tics in milliseconds.

I have found  the following in a FreeRTOS based code

http://reviews.openpilot.org/browse/~br=next/OpenPilot/flight/modules/GPS/GPS.c?r=c6a773363fb0ff1c7aa461f9991d815636204c27

timeNowMs

=

xTaskGetTickCount

()

*

portTICK_RATE_MS

;

This problem is described at

http://forums.openpilot.org/topic/44037-gps-nmea-ubx-code-adaptaion-data-tests/?p=353138

( sorry for redirecting you).

can I use it like timeNowMs = HAL_GetTick();

 

Would this result in same functionality ?

#freertos #milliseconds
1 REPLY 1
Posted on October 09, 2014 at 12:39

Hi,

The HAL_GetTick() API is used to:
  • Get current tick counter (incremented in Time base interrupt)
  • Manage timeout forperipherals drivers

There is a new API,HAL_InitTick() (not available in F4x STM32Cube V1.1.0), which is a weak function that configures the source of the time base, by default it is systick but can be redefined by user.

To conlcude, in your use case, you can use:

timeNowMs = HAL_GetTick();

since the the tick count is incremented on each tick interrupt. xTaskGetTickCount() does nothing more than return the current tick count. Regards, Heisenberg.