FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2009 Threads] if a task receiving data from queue when intPosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|