Quality RTOS & Embedded Software

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




Loading

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.

Regards.


portENTER_CRITICAL and SysTick

Posted by mbr4 on October 14, 2013

Thanks for clarification!


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




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS