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


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.


[ 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