Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


xTaskGetTickCount always returns 0

Posted by ramawidi on May 24, 2017

Hi, I working on STM32F4 Discovery with FreeRTOS ver 9. I use xTaskGetTickCount to see how long my task is working on. But xTaskGetTickCount always returns 0. This is my task code

void testprint(void) { uint32t waketime,temp1,temp2; const uint32t period = 100; char buff[32];

wake_time = xTaskGetTickCount();
	tamp1 = xTaskGetTickCount();
	sprintf(buff,"Tick1 = %u\n",temp1);


	tamp2 = xTaskGetTickCount();
	sprintf(buff,"Tick2 = %u\n",temp2);



Anyone help?

Thank You

xTaskGetTickCount always returns 0

Posted by omar93 on May 24, 2017


I am working with Xilinx Zynq ZC702 and I have the same problem..

xTaskGetTickCount always returns 0

Posted by kenchang1 on May 24, 2017

Does the code compile? Any warnings (implicit declaration of variables)? TYPO: tamp1, tamp2 should be temp1, temp2.

xTaskGetTickCount always returns 0

Posted by rtel on May 24, 2017

Sounds like the tick interrupt is not running. Is it installed? See the first question of the FAQ page "my application does not run, what could be wrong?". I think there is a link to the page in the comments at the top of each source file.

xTaskGetTickCount always returns 0

Posted by ramawidi on May 28, 2017

No I don't have any warnings. Sorry for the Typo. Actually tamp1 & tamp2 is temp1 & temp2. And I'm sorry, I don't get what do you mean about installed? Do you mean Tick is installed? correct me if I'm wrong

xTaskGetTickCount always returns 0

Posted by hs2sf on May 28, 2017

Question is if the SysTick interrupt / its ISR is properly installed. Note that this is port / BSP specific. For STMF4 ie. Cortex-M4 architecture you have to prepare the exception vector table containing the interrupt handlers used by your application. It should at least contain the entries required by FreeRTOS to run. These are defined in your FreeRTOSConfig.h: ~~~ /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names. */

define vPortSVCHandler SVC_Handler
define xPortPendSVHandler PendSV_Handler
define xPortSysTickHandler SysTick_Handler


xTaskGetTickCount always returns 0

Posted by ramawidi on May 31, 2017

Hi, HS2 When I checked my FreeRTOSConfig.h those 3 lines is not available so I add it and works. Thank you so much for your help

Regards, Rama

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists