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


FreeRTOS for a multi-threaded application

Posted by manigrand on January 11, 2017

Hello, I am a beginner with embedded programming. I would like to have some details about how the various components of FreeRTOS can be used for the application described below. I would like to have the details of not just the features, but also the names of the functions/procedures in the code of FreeRTOS that can be used for the following application to achieve maximum efficiency and reliability.

Application: There will be many COM ports running: pulling in GPS Receiver data via RS-232/422, sensor data over RS-422 and LVDS, transceiver modem over RS-232, telemetry data over RS-422, etc. Many devices and com ports must run simultaneously and not lose data (with CRC checks on each Com port running).

Basically, we are looking for an ability to run many threads – about ten simultaneously (mainly COM ports RS-232/422, USB, Ethernet, LVDS) with CRC checks and not have any data drops. This is going to be a hard real-time embedded application.

Thank you.

FreeRTOS for a multi-threaded application

Posted by rtel on January 11, 2017

Your question is very broad, almost more of a consultancy project, and even then would require a lot more details from yourself to give an answer. I would recommend starting with the book that is now available here http://www.freertos.org/Documentation/RTOS_book.html then if necessary come back with some more specific questions.

FreeRTOS for a multi-threaded application

Posted by richard_damon on January 12, 2017

As RTE indicated, this isn't so much a question about what feature in FreeRTOS you will use, but a programming exercise in designing and writing the actual code to implement your application logic.

The basic layout of your program would be to have an ISR for every comm port (that is normally how serial ports work) which gather the data and send it to the appropriate task. Avoiding data loss is purely a matter making sure you have enough buffer space and that your processing tasks can take the data fast enough.

The simplest method would be for each ISR to just put the received data into a Queue, one for each serial port, and the tasks pulling the messages out of the appropriate queue. This has a high processing overhead, but for many serial devices that really use RS-232 the data rates are likely slow enough that this will work.

If the data reate really are too high for this, then the ISRs need to be a bit smarter and build up a full 'message' in a buffer and send notification to the task that it has a message to process. This requires each serial port ISR to understand the basic data format of the device it is receiving from.

All of this code is considered 'Application Specific' and not proviced by FreeRTOS, it just provides the basic ISR -> Task communication primatives, not the serial port drivers, though there may well be a sample in the code examples (which will be the queue based approach),

[ 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