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




Loading

if a task receiving data from queue when int

Posted by francis wang on August 9, 2009
What will happen if a task is receiving data from a queue when an interrupt comes,and the interrupt send data to the same queue using the api function?
Can anyone give a efficient solution of serial receiving if the length of data to be received is unknown, how to handle the possible buffer overflow?

Regards!
wfrancis

RE: if a task receiving data from queue when

Posted by Richard on August 9, 2009
You don't need to worry about mutual exclusion on a queue - the kernel takes care of all that for you.

Generally the most efficient way of receiving data would be to turn all FIFOs and DMA that is available on. Then either have the DMA place all received data into a buffer and interrupt a task to process the data if necessary, or have the UART interrupt a task to process the data when either there is enough data to process, a complete message has been received (as determined by the interrupt service routine), or there is a break in the transmission.

The interrupt can signal events to the task, and in so doing unblock the task, using either a binary or counting semaphore as appropriate for your application.

Do not use a queue to pass individual characters between an interrupt and task unless the data rate is low. The examples in the FreeRTOS download do this to demonstrate the mechanism but also to deliberately load up the system with interrupt and processing overhead to test the port is working correctly.

Regards.


[ 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