Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

rewrite queue struct or use freertos queue

Posted by gurushen on June 13, 2013
Hi, I need a queue structure for passing bytes for a uart driver. I was using the freertos queue implementation but a co-worker insist on writing our own queue struct. Is there any benefit of rewriting our own?

RE: rewrite queue struct or use freertos queue

Posted by Richard Damon on June 13, 2013
It might be possible to write a slightly more efficient queue knowing that one end is alway an interrupt routine, and maybe some others knowable special cases (like it is always 1 byte at a time being sent, if that is how you are doing it). I am not sure if the improvements are worth the extra work and risk of bugs.

RE: rewrite queue struct or use freertos queue

Posted by Jack Peacock on June 15, 2013
While the FreeRTOS queue works well and is easy to use it does have some drawbacks. It's oriented toward one character at a time rather than block transfers. I did go the separate FIFO driver route in order to minimize interrupt overhead. I read and write blocks of data through a FIFO, also making use of DMA to reduce USART TX interrupts by as much as 100 to 1 (sending large Modbus messages).

If your data rate is low use the FreeRTOS queue, but if you have a high data rate your co-worker is right...roll your own buffer management. USART interrupt overhead can be significant.
Jack Peacock

RE: rewrite queue struct or use freertos queue

Posted by Richard on June 15, 2013
“It's oriented toward one character at a time rather than block transfers”


A queue can be created to hold blocks of any size, although each block in a queue has to be the same size. To queue really large blocks you would queue a pointer to the block instead of the block itself.

The FreeRTOS queues are designed for their purpose.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner