Serial communication service & queue

kolodko1 wrote on Saturday, May 19, 2007:

Hello group.

I have a few question:

1. How to fast pure queue but not by

while (xQueueReceive(…) == pdTRUE )
{ /* Empty */}


2. I also need function to fast see what is in queue. I can only read but I need something to read from queue with leave item in queue. In particular I need it to serial communication service (UART, RS-232 etc.). It have to be fast.
Maybe it isn’t good solution to use Queue from freeRTOS with size item equal 1 byte to serial communication service? What you think? What you use?

3. Can I use vTaskResume() from ISR? I can’t find it in documentation.

davedoors wrote on Monday, May 21, 2007:


Don’t know what you are asking, but there is no need to place the xQueueReceive() in a while loop if you are using a newer version of FreeRTOS.


Queue implementations in ISRs are not always a good idea.  It is best to use the DMA of FIFO of the peripheral to capture data, then a semaphore to wake a task to process the data.  This is much more efficient.


No - but there is a separate vTaskResumeFromISR() function that can be used.  Generally waking tasks from interrupts is best done using a semaphore as you will not get into a situation where the task suspends as the ISR is calling Resume.

kolodko1 wrote on Tuesday, May 22, 2007:

1) Maybe, but how? How to fast clean Queue using freertos’ API.

3) Now i see, indeed there is vTaskResumeFromISR() …, strange, code-completion did not show me this function. (v4.1.3 and codeblocks 3960)
But You did not write why use semaphores is better then resume task.