Quality RTOS & Embedded Software

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


How to Synchronize Multiple tasks

Posted by mukeshtalks on June 14, 2016


I am working on FreeRtos Version 7.6. My application is Solar inverter based on STM32f3 CortexM4f3 Controller. Kernel tick is 1ms. I have created 4 tasks: 1. Task for Battery Charging Using Solar 2. Task for Inverter Control 3. Task for HMI(LCD and Keypad) 4. Task for Serial Communication. Wait for Que to receive data from USART interrupt.

Here i have kept the Task1, 2 and 4 at lowest priority (2), and Task 3 is at highest Priority(3) but there is a task delay of 4 Seconds so that other task get chance to run. Now i am facing the issue the task are not synchronised and not working properly. I need to Synchnorize them. I need help in uderstanding the the different and best option for synchronizing the task.

Regards, Mukesh

How to Synchronize Multiple tasks

Posted by davedoors on June 14, 2016

see http://www.freertos.org/xEventGroupSync.html

How to Synchronize Multiple tasks

Posted by mukeshtalks on June 14, 2016

Thanks Dave, Can i use other methods like Binary semaphores, Mutex Etc.

How to Synchronize Multiple tasks

Posted by rtel on June 14, 2016

I don't think the description of your problem is detailed enough to say, nor do you say why you would favour another method over xEventGroupSync().

xEventGroupSync() is designed specifically to synchronise more than two tasks at once. If you only want to synchronise two tasks at any time then you could use any of the communication mechanisms.

How to Synchronize Multiple tasks

Posted by mukeshtalks on June 14, 2016

Hi, Thnaks for your quic reply. Actually My application is using FreeRTOS Ver 7.6, Which i dont want to change to latest version at this movement because project is almost at end state and dont know the side effects of upgrading the RTOS version and don't have time as well. In this version xEventGroupSync() is not there if i am not wrong. I thing by syncronizing two of my major task Task 1 and task 2 (As mentioned Above) i feel My major problems can be solved but I need to try.

My Problem is both tasks 1 & 2 are running at the same priroity at kernel tick (1ms). But sometime both are executing at every 1ms and some time One of the task take more time to execute. Because of this My close lopp written in both the tasks are not working. I also share the structure b/w both task using mutex to avoid memory corruption.

Can you please suggest the simplest way to overcome this situation.

[ 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.

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.


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


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