cancel
Showing results for 
Search instead for 
Did you mean: 

How can I program the microcontroller for multi-thread?

KKIM.6
Senior

I want to disassemble the ADC function and BLE data transmission asynchronously.

So, I want to program the microcontroller using multi-thread.

When I coded BLE, It look already used multi-thread but I couldn't understand it exactly.

Is there any example of this?

1 ACCEPTED SOLUTION

Accepted Solutions
Ronan GABOU
ST Employee
5 REPLIES 5
iSaeed62
Associate II

Hi @KKIM.6​ 

Firstly, You need to implement an RTOS, then, for example, you can add your threads in the main.c file. Inside each thread, you can call a function. Each function should have a while(1) loop inside.

Ronan GABOU
ST Employee

Hello,

You can use STM32CubeMX and select RTOS.

For example for STM32 L4 you can select FreeRTOS and then you can add tasks thanks to CubeMX GUI and generate the project.

Is there any official Youtube video to follow?

Ronan GABOU
ST Employee

Hello,

There is a MOOC for FreeRTOS on ST Youtube : https://www.youtube.com/playlist?list=PLnMKNibPkDnExrAsDpjjF1PsvtoAIBquX

Thanks for your reply. I'll check the videos!