Quality RTOS & Embedded Software

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


SAM7 driver interrupts

Posted by Dustin Stahlback on September 8, 2008
I am using the following:

Current freeRTOS (5.0.3)
GCC 4.2.1
Followed the Rowling/GCC AT91SAM7X demo

I currently create all interrupt code in ARM - naked and wrap the calls with portSAVE_CONTEXT and portRESTORE_CONTEXT. The SAM7 has an AIC and my dilema I only wish to disable/mask certain parts of an interrupt. The example being is that I have a uartISR and a spiISR. When I am dealing with something critical with the UART, I would only like to to mask the UART ISR, not the FIQ and nIQ which in turn disables all interrupts. When I need to disable IRQ's, I am under the impression that I must only use ENTER_CRITICAL and EXIT_CRITICAL in my code and not try and mask individual interrupt flags (my code breaks if I try this). Am I doing this incorrectly or is that how the demo was created. Does anyone have any idea or can point out other forum postings that deal with this?



RE: SAM7 driver interrupts

Posted by Dave on September 9, 2008
One of the problems with the ARM7 is that each has a different interrupt controller so there is no single generic solution (the Cortex ports don't have this problem).

Take a look at http://www.freertos.org/a00110.html#kernel_priority . You can basically copy this scheme by selecting which interrupts to disable and enable. If your ISR never calls an API function then you need never disable its interrupt as far as I know.

One easy thing you can do is change portENTER_CRITICAL() and portEXIT_CRITICAL() so they disable IRQ only and leave FIQ enabled. This is very common.

RE: SAM7 driver interrupts

Posted by Dustin Stahlback on September 9, 2008
If none of my ISRs have to interact with the RTOS, do I even need make them naked? My ISRs basically handle peripheral functions (UART, SPI). I try to disable interrupts so I can modify/check pointers and then re-enable.

RE: SAM7 driver interrupts

Posted by David Farrell on September 9, 2008
Most of what your describing is handled entirely by interrupt priorities or the masking of the AIC. Also note that the RTOS is a lower priority than your ISRs, the only thing you should have to save is the registers used, interrupt type, I don't know about naked. Search this forum there are recent threads about the kernel priority. In the recent threads I think Richard comments about empty and fill pointers, done right you may not need to disable interrupts at all to modify them.

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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner