Quality RTOS & Embedded Software

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


Loading

FreeRTOS mechanism for a synchronous message

Posted by avivf on June 26, 2018
Definition:

"Synchronous message" means taskA sends a message to taskB, and waits for a reply from taskB. taskA is blocked while waiting for a reply, and upon receiving a reply continues from the where is stopped. Reply message may have data in it.

Question:
  • Does FreeRTOS have any mechanism which implements the above definition for synchronous message?
  • Does anybody can help with it?

Thanks, A.F


FreeRTOS mechanism for a synchronous message

Posted by heinbali01 on June 26, 2018

Many ways to go here, my favourite would be :

TaskA passes it's task handle (xTaskGetCurrentTaskHandle()) as part of the message to taskB. Messages can be passed in a queue. TaskB handles the message, and when done it will wake up taskA. When handled, it wakes up taskA by calling xTaskNotify(). TaskA will block in xTaskNotifyWait() until woken up.


FreeRTOS mechanism for a synchronous message

Posted by richard_damon on June 26, 2018

As Hein impilies, FreeRTOS doesn't have a primative for that operation, but you can build up a way to do it.

But, if you generalize the meaning of Task (and from the domain where that definition comes from, you can generally do so), you DO have a mechamism that matches this mode of operation, the function call. In my experience, often when I find the need for this sort of interaction between my tasks, I need to ask myself if TaskB has a REAL need to be a seperate task, or can it be just a function that I call, If part of the definition of TaskB is that it serializes its requests, that can be acheived with a mutex, which is a lot lighter weight than a full task.

If you are generating fully isolated Restricted Tasks with the MPU, then it is more likely that a seperate Task may be appropriate, and the request and reply sent via Queues (each task having its own Queue to process).


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


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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

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

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

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Mediatek

Renesas

RISC-V

SiFIve RISC-V

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