Quality RTOS & Embedded Software

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




Loading

Inter task communication via bits array

Posted by student01 on February 20, 2017

Hello,

I have been developing control software based on FreeRTOS. I have divided the whole software into several tasks (the first executed every 1 ms, the second executed every 20 ms and third executed every 100 ms). Each task call several me defined functions. These functions have as one of their parameters some bit variables (for example signal for blocking the PI controller or ramp calculation). One task for example sets the bit for PI controller blocking and function called in another task reads value of this bit and changes its behavior accordingly. These bit variables are defined in a "bit array" which is shared by the tasks. I have written several functions for manipulating with the bits in the bits array. But I have problem with synchronizing the access to the bits array from the tasks. I have tried to take semaphore (mutex) at the beginnig of each bit handling function and then release the semaphore (mutex) at the end. But these tries were unsuccessful. The bits in the bits array are randomly overwritten by the tasks and all the timing of the software is corrupted. I don't know where the problem is. I am also not sure if my "architecture" with the shared bits array is the right one. Can anybody more experienced give me any advice or recommendation how to solve this problem? Thanks in advance for any suggestions.


Inter task communication via bits array

Posted by rtel on February 20, 2017

Have you considered using an event group? http://www.freertos.org/FreeRTOS-Event-Groups.html


Inter task communication via bits array

Posted by hs2sf on February 21, 2017

Sounds like you could also make use of the somewhat new 'Notification' feature if it provides enough bits for your purposes.


[ 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