Quality RTOS & Embedded Software

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




Loading

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) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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