cancel
Showing results for 
Search instead for 
Did you mean: 

H743 FreeRTOS

HMSEdinburge
Associate II

HI I m using H743 Nucleo, to write a RTOS program with 2 tasks which gonna access to the same memory location concurrently.. can anyone advise which  RTOS method to use ? Tasks ? Semaphore? Message Queue? 

7 REPLIES 7
AScha.3
Chief III

Hi,

Depends on what you want:

- just use it on both tasks: make a global volatile variable 

- have some control, when a task is allowed to use it: use a semaphore 

 

Don't forget, you are on a single core here, so it's never really concurrent in many tasks, it's always only one task running for some milliseconds, then the other or next.

If you feel a post has answered your question, please click "Accept as Solution".
mƎALLEm
ST Employee

Hello,

What do you mean by "access to the same memory location concurrently"?

Even with RTOS only one instruction is executed at a time. The RTOS scheduler makes the tasks seem to be executed in parallel.

STM32H743 MCU is a single core product. There is no worry about the HW concurrence to a memory.

Now if you are talking about mutual exclusion on a specific variable, structure etc, this is another thing.. You need to manage it with mutex or semaphore ...

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Sounds like what you really need is a tutorial on FreeRTOS (maybe RTOS in general) - none of this is specific to STM32.

https://www.freertos.org/Documentation/01-FreeRTOS-quick-start/01-Beginners-guide/00-Overview

https://www.freertos.org/Documentation/00-Overview 

https://www.freertos.org/Community 

How to acheive concurrent if use mutex? doesn't mutex mean exclude 1 task from another?

ok agree, not concurrent but simultaneously... in this case, could the 2 tasks access to the same memory location (where ext. input data from ADC are stored)


@HMSEdinburge wrote:

How to acheive concurrent if use mutex? doesn't mutex mean exclude 1 task from another?


If you are not familiar with RTOSes, I suggest you to learn about it.

and especially mutexes: see that video: https://www.youtube.com/watch?app=desktop&v=I55auRpbiTs&t=0s

 

"not concurrent but simultaneously... in this case, could the 2 tasks access to the same memory location"

Nothing is done simultaneously in RTOS. As I said,  with RTOS only one instruction is executed at a time. The RTOS scheduler makes the tasks seem to be executed in parallel.

 


@HMSEdinburge wrote:

How to acheive concurrent if use mutex? doesn't mutex mean exclude 1 task from another?


That doesn't have a specific relation with STM32.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Right, problem solved. 

-> use global volatile variable.

If you feel a post has answered your question, please click "Accept as Solution".