FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [February 2017 Threads] Inter task communication via bits arrayPosted 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 arrayPosted 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 arrayPosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|