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


Handling FreeRTOS interrupts with some delay

Posted by kand123 on July 29, 2015

Hello everybody,

I am working on a project which consists of an embedded system with an Atmel AVR32 microcontroller and FreeRTOS. The system has 8 fans connected to different GPIO pins and it produces separate interrupt for every fan (if it is faulty or not installed and if it is OK). I have implemented this specification with a FreeRTOS ISR and a queue (using xQueueSendFromISR when the status change) by sending the status to a task which wait for queue reception. The task then informs the user. My problem is that I want to delay for some time after an interrupt arise in order to be sure of the fan status avoiding rapid on/off situations. How can I do this in FreeRTOS apart from implemented 8 tasks and checking the status of every fan with some delay?

Thanks in advance.

Handling FreeRTOS interrupts with some delay

Posted by heinbali01 on July 29, 2015

Hi Kostas,

Atmel AVR32, is that a UC3 ?

If you need debouncing of 8 signals, is it still useful to use hardware interrupts?

You might also create a task that wakes up at regular intervals and let it poll for changes. Only after N confirmations of a new status the task will produce an event.

And of course, you can still use the hw interrupts for urgent signals like an over-voltage, or an electric motor control.


Handling FreeRTOS interrupts with some delay

Posted by kand123 on July 29, 2015

Hi Hein,

Yes I use Atmel AVR32 UC3C.

I use hardware interrupts to get every one of the 8 signals which is not urgent signals. My problem is that I need to debounce every one of them.

How can I do this using interrupts or it is better to use one task and poll every one of them at regular interval which is not safe as these are asynchronous events.


Handling FreeRTOS interrupts with some delay

Posted by richard_damon on July 30, 2015

One way to use interrupts to catch the leading edge of a bouncing signal, but not get overloaded with the bounces is to disable the interrupt on the leading edge, and kick off a timer function to fire after the bounce time to re-enable the interrupt.

But, since you make the comment that you want to wait a bit before reporting (which could be done in that timer function I just mentioned), it likely means that just polling periodically may also be sufficient. This is basically a requirements trade off. The use of interrupts and a timer may give you slightly faster response, and possibly lower cpu usage (since it really does nothing in the case of no change), while periodic polling is likely simpler code.

[ 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