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


portENTER_CRITICAL and SysTick

Posted by mbr4 on October 14, 2013

I have a question related to Cortex-M3 port of portENTER_CRITICAL() function. It disables interrupts, but should it also disable SysTick interrupt?

portENTER_CRITICAL and SysTick

Posted by davedoors on October 14, 2013

If you are looking at official FreeRTOS code then portENTER_CRITICAL() does not disable interrupts, it only masks interrupts up to a user settable priority level. The systick is the lowest priority interrupt so will always be masked inside a critical section.

portENTER_CRITICAL and SysTick

Posted by mbr4 on October 14, 2013

So it means that SysTick won't be counted during critical section?

portENTER_CRITICAL and SysTick

Posted by richardbarry on October 14, 2013

If a SysTick occurs inside a critical section it will be held pending by the hardware until the critical section was exited.

Typically an application will configure the tick to occur ever 10 or 100ms. Critical sections should always be kept very short, and should never be anywhere near as long as one tick period.

If you need a longer critical section then consider using scheduler locking instead (vTaskSuspendAll() and xTaskResumeAll()). Tick interrupts that occur while the scheduler is suspended are help pending in software so more than one can be pended. When the scheduler is unlocked (resumed) any pending tick interrupts are 'unwound' so you don't get any time slippage.


portENTER_CRITICAL and SysTick

Posted by mbr4 on October 14, 2013

Thanks for clarification!

[ 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