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


Interrpts in FreeRTOS

Posted by Austin Salgat on May 24, 2009
I'm new to embedded OSs and was curious how interrupts work in FreeRTOS. For example, when I receive a message via the UART peripheral and an interrupt occurs, how do I tell FreeRTOS what task to execute to handle that?

RE: Interrpts in FreeRTOS

Posted by sotd on May 24, 2009
Every demo comes with example interrupt to copy. Every demo document page on the web site has a writing an interrupt section.

RE: Interrpts in FreeRTOS

Posted by Austin Salgat on May 24, 2009
I went through my demo, everything worked great, and I read through the website but have not found a page devoted to explaining how interrupts work as far as starting up a specific task. Can you be more specific as to where I can find this?

RE: Interrpts in FreeRTOS

Posted by dave m on May 24, 2009
You didn't post your platform information (at least, not in this thread) so I can't be more specific, but:

In FreeRTOS, you frequently set up an ordinary task (maybe with a high priority) to handle interrupts. This task spends most of its time sleeping while waiting for a semaphore to be tickled. When an interrupt occurs, the low-level ISR does any work that must happen immediately and then tickles the semaphore. The task wakes up and does whatever else is necessary.

In my code, I have the ISR disable the interrupt at issue, and then the interrupt-handling task re-enables it when everything has been taken care of. I think this is a common way of doing things.

So, to directly answer your question: you don't have to tell FreeRTOS anything about which task goes with which interrupt. You just set up a semaphore, and have one task that sleeps on it, and an ISR that tickles it. (You could have multiple ticklers if you want, and maybe even multiple sleepers.) There's nothing special about the ISR-to-interrupt-handler communication that's any different from any other task-to-task communication. (Except, possibly, that certain FreeRTOS functions can't be called from the ISR. You can only call functions whose names end in "_fromISR")

RE: Interrpts in FreeRTOS

Posted by Austin Salgat on May 24, 2009
This is for the AVR. So what you are saying is that I setup an ISR like I'd usually do without an OS, disable all interrupts, for the UART example do a quick read and copy to an array, and then have a high priority task that will handle the newly modified array after the ISR is completed, correct?

RE: Interrpts in FreeRTOS

Posted by Toan Pham on June 3, 2009

you're not alone,

setting up interrupts in free rtos is a little different than the AVR.

There's a convention in avrs. All Interrupt handlers start with name_vect (ref.http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html).

in free tos it is different. However, i found a niffy library that helps in terms of doing anything on the ARM (lib_AT91SAM7S64.h) ***google it*****
Pretty much, alot of stand routines of setting up the mcu is reference in that API.

[ 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