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


vPortSuppressTicksAndSleep semantics

Posted by J Hamilton on June 18, 2013
FreeRTOS 7.4.2, Atmel SAM3U (ARM Cortex-M3), Atmel Studio 6.1
HI there, I am working on modifying the SAM4L low-power tickless idle implementation (from the demo) for the SAM3U and I'm finding the comments around the interrupt disable confusing in the demo version of

// Enter a critical section but don't use the taskENTER_CRITICAL() method as
// that will mask interrupts that should exit sleep mode.
__asm volatile( "cpsid i\n\t"
"dsb\n\t" );

Essentially the same thing shows up in the standard CM3 port code.

If I understand the assembly correctly, this is disabling ALL interrupts (except NMI & faults) so the timer used to wake the processor doesn't get it's interrupt handled until "
cpsie i
" is called later. HOWEVER, the comments indicate that the quoted code will somehow mask off fewer interrupts than
. I looked at the code involved there, and it just changes the BASEPRI register to some intermediate value, which, if I understand correctly, will mask off interrupts with lower priority (higher numeric value on a CM3) than BASEPRI, but not all interrupts (unless it is set to zero).

Am I missing something or are these comments not applicable and misleading?


RE: vPortSuppressTicksAndSleep semantics

Posted by J Hamilton on June 18, 2013
Oops, sorry about the misuse of the code tags. Didn't realize they would format that way.

RE: vPortSuppressTicksAndSleep semantics

Posted by Richard on June 19, 2013
When in a low power mode the Cortex-M3 *will* allow an interrupt to bring the MCU out of sleep mode even when interrupts are globally disabled using the i bit in the CPSR (set by the CPSIE i instruction). The interrupt will not actually be processed by the MCU until interrupts are again re-enabled.

However....only interrupts that are not masked by the BASEPRI setting will do this. Therefore, if you use taskENTER_CRITICAL() interrupts will remain enabled, but the interrupt you want to bring the system out of sleep mode will be masked, and therefore the MCU will not exit sleep mode even though the interrupt fired.


RE: vPortSuppressTicksAndSleep semantics

Posted by J Hamilton on June 20, 2013
Thank you Richard! That clarifies things immensely.

[ 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