Quality RTOS & Embedded Software

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


Inter task communication via bits array

Posted by student01 on February 20, 2017


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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists