EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

FreeRTOS and high speed UARTs of LPC210x

Started by stevec November 16, 2010
Testing FreeRTOS on LPC2106 with both UART channels outputting at 115K baud. I'm using the transmit FIFOs, so the interrupt rate is 1/16th what it would be without FIFOs (I'm amazed at how rarely I see sample code using the FIFO or using it such that it cannot do its purpose).

The issue and question is: I'm using the FreeRTOS message queue to service the transmit UARTs. With message queues of one byte per item, which is the case for UARTs handling variable sized data (binary and text), the ISR loop to do 16 reads from the queue consumes some 60 microseconds to do so. If I did my own circular buffer, it would be like 6 microseconds.

Anyone done a gatekeeper type of UART ring buffer driver from FreeRTOS for LPC21xx before I reinvent the wheel again?

An Engineer's Guide to the LPC2100 Series

Hi Steve,

If you want a high interrupt rate with a lot of data you are best using
a RAM ring buffer + FIFO (as you are) or DMA and then use a binary or
counting semaphore to signal when there is data in the buffer. This is
a very common technique and the recommended method. Passing each
character in turn on a queue is very inefficient - although the demo app
does this it does note that it is to demonstrate the queue being used
and not intended to be an example of an efficient implementation.

Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.

On 17/11/2010 00:24, stevec wrote:
>
>
>
> Testing FreeRTOS on LPC2106 with both UART channels outputting at 115K
> baud. I'm using the transmit FIFOs, so the interrupt rate is 1/16th what
> it would be without FIFOs (I'm amazed at how rarely I see sample code
> using the FIFO or using it such that it cannot do its purpose).
>
> The issue and question is: I'm using the FreeRTOS message queue to
> service the transmit UARTs. With message queues of one byte per item,
> which is the case for UARTs handling variable sized data (binary and
> text), the ISR loop to do 16 reads from the queue consumes some 60
> microseconds to do so. If I did my own circular buffer, it would be like
> 6 microseconds.
>
> Anyone done a gatekeeper type of UART ring buffer driver from FreeRTOS
> for LPC21xx before I reinvent the wheel again?
>
>


The 2024 Embedded Online Conference