Skip to main content
KKIM.6
Senior
Nov 1, 2022 7:35 PM UTC
Solved

How can I program the microcontroller for multi-thread?

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?

    This topic has been closed for replies.
    Ronan GABOU
    Ronan GABOUBest answer
    ST Employee
    Nov 2, 2022 1:10 PM UTC

    Hello,

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

    5 replies

    iSaeed62
    Associate
    Nov 1, 2022 8:02 PM UTC

    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
    Nov 2, 2022 9:16 AM UTC

    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.

    KKIM.6
    KKIM.6Author
    Senior
    Nov 2, 2022 9:49 AM UTC

    Is there any official Youtube video to follow?

    Ronan GABOU
    Ronan GABOUBest answer
    ST Employee
    Nov 2, 2022 1:10 PM UTC

    Hello,

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

    KKIM.6
    KKIM.6Author
    Senior
    Nov 10, 2022 12:04 PM UTC

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