Quality RTOS & Embedded Software

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


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

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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