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


Call xTaskGetTickCount from ISR freezes STM32

Posted by Todd on March 15, 2009
I am using STM32 w/ FreeRTOS 5.1.2
When I call xTaskGetTickCount() from an ISR (specifically EXTI0), the application freezes up.

The solution was to remove the taskENTER_CRITICAL(); and taskEXIT_CRITICAL(); calls from the xTaskGetTickCount() function, these are not needed on 32-bit anyway.

My suggestion for future versions is a #IF to remove these calls on 32-bit architectures.


RE: Call xTaskGetTickCount from ISR freezes S

Posted by Richard on March 16, 2009
See number 3 on the following page: http://www.freertos.org/FAQHelp.html

Version 5.2.0 has removed critical sections from a few places where they were not necessary, however the type used to hold the tick count is configurable so the critical section remains there.

It might be better to have a "get tick count from isr" function, or to just make the tick count accessible.


RE: Call xTaskGetTickCount from ISR freezes S

Posted by Todd on March 17, 2009
I agree that a "get tick count from isr" function would be beneficial. As an example, my application uses a hall sensor that measures RPM of a motor. Every rotation of the shaft generates a interrupt which measures the time since the last interrupt. I could imagine a few other situations were the "get tick from isr" would be helpful.

Hopefully this can be implemented in a future version.


RE: Call xTaskGetTickCount from ISR freezes STM32

Posted by Samuel Tardieu on March 19, 2009
Todd: in your case, I think you should use another timer in counter mode, maybe automatically triggered by the interrupt from the hall sensor.

The system tick will typically have a quite low frequency (1ms), while you could easily get much more accurate information.

[ 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