inflearn logo

Introduction to STM32 (Blue Pill) Firmware Development — Learning CubeIDE & FreeRTOS Without Additional Components

The smartwatches, wireless earbuds, robot vacuum cleaners, cars, drones, kiosks, and medical devices we use every day contain small computers that receive user input, assess situations, and control the devices. These systems are called embedded systems. However, getting started with embedded systems is more difficult than it may seem. While it is easy to find examples of turning on an LED online, it is not easy to systematically learn the operating principles of real electronic devices, such as: "How does an electronic device respond when a button is pressed?" "How can it operate accurately at set intervals?" "How can multiple functions run simultaneously?" "How can it remember its settings even after being powered off and back on?" In this course, rather than memorizing complex theories or code, you will operate a small development board yourself and gradually understand the core principles of embedded systems one by one. Starting with basic hands-on exercises for controlling LEDs and buttons, you will progressively learn the core functions used to build real electronic devices, including Interrupts, Timers, PWM, ADC, Memory, and Watchdog. Finally, you will use an RTOS (Real-Time Operating System) to combine the functions you have learned individually into a single system in which multiple functions operate simultaneously. The goal of this course is not simply to teach you how to use a specific development board, but to build the foundational skills needed to understand and implement how hardware is controlled by software when working with various electronic devices and development boards in the future.

9 learners are taking this course

Level Beginner

Course period Unlimited

stm32
stm32
stm32cubeide
stm32cubeide
embedded-systems
embedded-systems
C
C
FreeRTOS
FreeRTOS
stm32
stm32
stm32cubeide
stm32cubeide
embedded-systems
embedded-systems
C
C
FreeRTOS
FreeRTOS

What you will gain after the course

  • How Electronic Devices Operate Using Software

  • Understanding the Core Functions of Electronic Device Systems

  • Software debugging skills

  • Multitasking (multiple functions operating simultaneously) programming

Developing STM32 Firmware Yourself

From GPIO to a Comprehensive FreeRTOS Project

Did you buy an STM32 but feel lost about what to study after LED blinking?

Turning on a GPIO once and copying example code from the internet to run ADC or PWM isn’t difficult.

However, when you actually try to create a program yourself, questions arise.

Why are interrupts used?
How is a timer different from HAL_Delay?
How are ADC values actually read?
How are the PWM period and duty ratio determined?
How can you retain data even after turning the power off and back on?
Why are FreeRTOS tasks, priorities, and queues needed?

This course was created to answer questions like these.

Using the STM32F103C8T6-based Blue Pill and STM32CubeIDE, you will implement everything from GPIO and interrupts to timers, ADC, PWM, flash memory, and FreeRTOS yourself.

This is not a course that simply lists how to use HAL functions.

You will learn each function, implement it yourself, verify the variables and the MCU’s behavior, and finally connect everything you have learned to complete a small FreeRTOS-based embedded system.


Don’t Stop at LED Blink

When you first study STM32, you usually start as follows.

Blink the LED using HAL_GPIO_TogglePin(), and check its operation by changing the number in HAL_Delay().

However, in actual embedded programs, this alone is not sufficient.

You need to process button or sensor events immediately, perform tasks at precise time intervals, read analog signals, generate PWM, and store the necessary data in Flash.

As the system becomes a bit more complex, it also becomes difficult to handle all the functions within a single while(1).

So, FreeRTOS appears at the end.

This course is structured around a natural learning progression that starts with LED blinking and leads all the way to FreeRTOS.

GPIO ↓ External Interrupt ↓ Timer Interrupt ↓ ADC ↓ PWM ↓ Input Capture ↓ Flash Memory ↓ FreeRTOS Task ↓ Priority / Task State ↓ Queue ↓ FreeRTOS Comprehensive Project

Rather than learning each feature separately and stopping there, you will understand why it is needed and then connect it to the next feature.


What You Will Gain from This Course

Before the Course | After the Course STM32CubeIDE feels difficult | Work directly from project creation through debugging Copy and use HAL code | Understand the role of each HAL API Implement only simple LED Blink functionality | Implement GPIO, Interrupt, Timer, ADC, and PWM directly Do not know why Interrupts are necessary | Can explain the difference between Polling and Interrupts Timer configuration values feel difficult | Understand the meaning of Prescaler and Period Only check ADC numbers | Convert ADC values into voltage and temperature Understand PWM only as a simple output function | Connect it to Period, Duty Ratio, and Input Capture Data disappears when the power is turned OFF | Store data in Flash Memory Use only a Super Loop | Understand a Task-based program structure RTOS terminology feels difficult | Understand Scheduler, Priority, Blocked, and Suspended Do not know how to transfer data between Tasks | Transfer data using a Queue Practice only one function at a time | Implement an integrated project using ADC + Queue + FreeRTOS + LED


It starts without expensive equipment.

When taking an embedded systems course, you may find yourself needing an oscilloscope, logic analyzer, various types of sensors, and development boards.

This course is designed to help you experience STM32’s core features with as little equipment as possible.

The basic equipment used is approximately as follows.

MaterialsPurposeSTM32F103C8T6 Blue PillPractice MCUST-LinkProgramming and debuggingUSB cablePower and connectionJumper WireRequired pin connectionsPCRunning STM32CubeIDE

Even without a separate oscilloscope, actively use STM32CubeIDE’s Debug and Live Expressions.

By visually confirming how the variables actually change, you understand how the program works.

For example, in the ADC lesson, rather than simply running the code and moving on,

ADC Raw Value ↓ Voltage ↓ Temperature

You can directly observe the changes.

In the FreeRTOS class:

Task Priority Number of Task Executions Number of Queue Data Items Transmitted Value Received Value

By checking them in Live Expressions, you will understand how the RTOS operates.


This is not a lecture where you simply type along with the code.

In this course, whenever a new feature is introduced, we first explain **“why it is needed.”**

For example, before learning about Interrupts, we consider the problems with the Polling method.

Before learning about timers, we examine the limitations of using only HAL_Delay().

Before learning FreeRTOS, we first examine what problems arise when handling multiple functions simultaneously in a Super Loop structure.

Before learning Queues, we consider a situation where data needs to be passed between two Tasks that previously ran independently.

Therefore, the basic flow of the lesson is always as follows.

Problem Discovery ↓ Understanding the Concepts ↓ CubeMX Configuration ↓ CubeIDE Coding ↓ Debugging ↓ Verifying Actual Operation

We focused on understanding why to use a function rather than memorizing it.


We use STM32CubeMX and CubeIDE together.

In STM32 development, you can configure all of the MCU’s Registers directly from scratch.

However, at the beginner level, it is easy to lose sight of the overall development process by studying numerous Registers just to use a single GPIO.

In this course, you will configure peripherals using STM32CubeMX and write programs using the STM32 HAL Library.

CubeMX → MCU and Peripheral configuration CubeIDE → Code writing HAL Library → MCU function control Debugger → Verify actual operation

Through this, you will learn the entire flow of creating an STM32 project, initializing peripherals, and executing user code.


We start with GPIO.

We will not deal with an RTOS from the beginning.

We start with the most basic GPIO.

After understanding what GPIO is, how MCU pins are used as inputs and outputs, and what source and sink methods are, you will control an actual LED.

Next, we move from simple output to event handling.

GPIO Output ↓ External Interrupt ↓ Timer Interrupt

This is how the functionality is expanded one feature at a time.


We do not use only Polling.

There is a difference between continuously checking the button state and using an interrupt to process it only when necessary.

In the External Interrupt exercise, you will understand Rising Edge and Falling Edge and directly verify how the Callback function is called.

In the Timer Interrupt exercise, you will practice a structure in which events occur at regular intervals even without a pin.

Therefore, not only writing simple code, but also:

Event occurrence ↓ Interrupt ↓ Callback ↓ User code execution

You can understand the important flow of an embedded program called this.


Read actual values using the ADC

It does not deal with only Digital signals.

You will also learn how to convert analog values into digital values using the STM32’s ADC.

We practice using the ADC without adding a separate sensor by using the STM32's internal temperature sensor.

Internal Temperature Sensor ↓ ADC ↓ ADC Raw Value ↓ Voltage ↓ Temperature

Rather than simply reading ADC numbers, we go further to understand how ADC values are converted into real-world physical quantities.


PWM is understood by separating theory and practice.

PWM is sometimes explained as merely controlling LED brightness, but in actual embedded systems, it is a very important function.

In the lecture, PWM’s:

Frequency
Period
Duty Ratio

First, understand the relationship.

Then, using CubeMX’s Timer settings, you will generate PWM directly.

You will also experience the process of capturing the Rising Edge and Falling Edge through Input Capture to understand the period and duty ratio of the input signal.

In other words,

Create PWM

rather than ending there,

Understand what PWM is ↓ Generate PWM ↓ Measure the timing of PWM

It continues through to this point.


Let's retain a value even when the power is turned off.

Variables in RAM disappear when the power is turned off.

Then where should data that needs to be retained even after the power is turned off and back on—such as product settings or usage counts—be stored?

In the Flash Memory exercise, data is:

Unlock ↓ Erase ↓ Write ↓ Read

stored in the following sequence.

Through the Boot Counter example, you will see the value increase each time the MCU is reset and confirm that the previous value remains even after the power is turned off and back on.

Through this, you will experience the difference between volatile and non-volatile memory in actual code.


Then we start FreeRTOS.

After experiencing the basics of peripherals, we move on to FreeRTOS.

We do not cover all the difficult RTOS features from the beginning.

First, we ask a question.

"Why do we need an RTOS?"

We examine the problems that can arise when running multiple functions in a Super Loop, starting by understanding why a program is divided into Tasks.

Super Loop Task A → Task B → Task C → Repeat

in,

FreeRTOS Task A ─┐ Task B ─┼→ Scheduler Task C ─┘

Expand it into a structure.


Observe the Scheduler and Task State visually.

The important thing in FreeRTOS is not simply creating multiple tasks.

You need to understand when a task runs and when it waits.

In the lecture:

Running Ready Blocked Suspended

We learn the states.

When you call osDelay(), the CPU does not stop; instead, you will also see that the Task enters the Blocked state, allowing another Task to run.


What impact does Priority actually have on execution?

Directly compare when the two Tasks have the same Priority with when one Task’s Priority is raised.

LedTask Normal CounterTask Normal

in,

LedTask Normal CounterTask AboveNormal

Change it to.

In Live Expressions, observe the number of executions of each Task to see how the higher-priority Task gets opportunities to run on the CPU.

And use Suspend and Resume to:

Running / Ready ↓ Suspended ↓ Resume ↓ Ready

We will also practice the process.


Pass data between Tasks

If you have created multiple tasks, the following question arises.

"How can ControlTask use the value created by SensorTask?"

This is where the Queue comes in.

ProducerTask │ │ Put ▼ Queue │ │ Get ▼ ConsumerTask

Understand the concepts of Producers and Consumers and transfer data using the FIFO method.

Also, when the Producer is faster than the Consumer:

Queue Data Growth ↓ Queue Full ↓ Put May Fail

We also directly check the situation.

It is structured so that you can understand a Queue not simply as an API, but as a data channel connecting Tasks.


At the end, you will complete an Embedded System.

In the final, fourteenth lesson, we will bring together everything we have learned so far.

The project topic is:

Controlling the LED Blink Speed Based on the Internal Temperature

입니다.

Measure the STM32's internal temperature sensor using the ADC.

The temperature measured by SensorTask is sent to ControlTask using a Queue.

In ControlTask, the temperature is evaluated to determine the LED toggle interval.

LedTask controls the PB2 LED at the determined interval.

Internal Temperature Sensor ↓ ADC ↓ SensorTask ↓ SensorQueue ↓ ControlTask ↓ blink_interval_ms ↓ LedTask ↓ PB2 LED

When the MCU temperature is low, the LED blinks slowly.

When the MCU is heated with a hair dryer, causing its internal temperature to rise:

Temperature ↑ ↓ Blink Interval ↓ ↓ LED Blink Speed ↑

The LED blinks faster.

This is the moment when the ADC, Queue, Task, Scheduler, osDelay(), and GPIO you learned in class become connected within a single system.


The learning roadmap for this course

Course Key Content Lesson 1: Understanding Embedded Systems and the Blue Pill Lesson 2: Setting Up the Blue Pill Development Environment Lesson 3: Understanding GPIO and the HAL Library Lesson 4: Controlling an LED with GPIO Output Lesson 5: Understanding External Interrupts Lesson 6: Time Control with Timer Interrupts Lesson 7: Reading Analog Signals with the ADC Lesson 8: Understanding PWM and SPWM Lesson 9: Practicing PWM Generation and Input Capture Lesson 10: Saving Data to Flash Memory Lesson 11: Why RTOS Is Needed and Your First FreeRTOS Practice Lesson 12: Task Priority and State Control Lesson 13: Transferring Data Between Tasks with a Queue Lesson 14: Comprehensive FreeRTOS Project

In the first part, you will understand each MCU peripheral one by one, and in the latter part, you will connect multiple functions into a single system using FreeRTOS.


Recommended for these learners

Recommended Audience and Reasons Those starting STM32 for the first time Start step by step, from setting up the development environment. Those wondering what comes after Arduino Experience the HAL-based STM32 development workflow. University students majoring in electrical engineering, electronics, or computer science Learn the basic workflow of MCU practice and RTOS. Those preparing a graduation project Connect the fundamentals of GPIO, ADC, PWM, Flash, and RTOS. Those who have only copied and used STM32 example code Learn why the code is needed, starting with the concepts. Those encountering FreeRTOS for the first time Proceed in the order of Task → Scheduler → Priority → Queue. Non-majors interested in embedded firmware Explanations use real-world examples and illustrations whenever possible. Those who want to study firmware after hardware design Learn the software workflow for directly controlling an MCU.


How much prior knowledge is required?

Professional embedded experience is not required.

However, it will be easier to follow the course if you have a basic understanding of C at roughly the following level.

Variables
if / else
for / while
Functions
Basic concepts of arrays

You don’t need to have prior knowledge of pointers or RTOS.

We explain what the code used in the course means, starting with the parts you need.


Scope covered in this course

The goal of this course is not to cover all of STM32’s peripherals at once.

experiencing a continuous progression from GPIO to FreeRTOS as a learner starting embedded firmware for the first time.

Therefore, the course focuses on GPIO, External Interrupts, Timer Interrupts, ADC, PWM, Input Capture, Flash Memory, FreeRTOS Tasks, the Scheduler, Priorities, Suspend/Resume, and Queues.

Communication peripherals such as UART, SPI, I2C, CAN, and USB, as well as advanced RTOS synchronization features such as semaphores and mutexes, are excluded from the scope of this course.

Rather than listing many features, we prioritized making each feature work in practice and connecting it to the next concept.


If you take it together with the first course,

In “Designing Electronic Circuits (Development Boards) Yourself—from Schematics to PCB Artwork,” we covered the process of creating hardware using STM32.

In this course, we cover firmware that operates the hardware using STM32.

The relationship between the two lectures is as follows.

First Course Circuit Design ↓ Schematic ↓ PCB Artwork ↓ Development Board Completed Second Course Development Environment ↓ GPIO / Interrupt / ADC / PWM ↓ Flash ↓ FreeRTOS ↓ Embedded System Completed

If you want to study both hardware and firmware, you can take the two courses consecutively.


It doesn’t end with simply turning on an LED.

What matters in this course is not the length of the code.

The goal is to be able to answer the following questions for yourself while studying STM32.

Why use interrupts?

Why is a timer necessary?

What does the ADC number mean?

How are the PWM period and duty ratio determined?

Why use Flash?

Why divide a program into multiple tasks?

Which Task will the Scheduler run when the Priority changes?

How is data passed between Tasks?

If you can answer these questions, you have done more than simply follow and run an example—you have begun to understand the structure of embedded programs.


By the end of the lecture

At first:

How do I turn on the LED?

It starts from.

And finally:

The sensor measures data ↓ The Task transmits the data ↓ Another Task makes a decision ↓ The output device responds

You will implement an Embedded System yourself.

The goal of this course is not to memorize every function of the STM32.

Experiencing how to configure the MCU, write code, verify its operation, and connect multiple functions into a single system.

That is the goal of this course.


From GPIO to FreeRTOS.

Experience firsthand the initial workflow of STM32 firmware development.

Recommended for
these people

Who is this course right for?

  • Those who have wondered how electronic devices work

  • Students starting majors related to electronics, computers, and AI

  • For those wondering what comes after Arduino (those who want to implement MCUs for practical applications)

  • Students preparing their graduation project or capstone design project

  • Those interested in embedded (electronic product) development but unsure where to start

Need to know before starting?

  • Basic computer skills

  • C language basics (You don’t need to know this.)

  • Basics of electronic circuits (You don’t need to know this.)

Hello
This is jungukko5750

Career Verified

51

Learners

8

Reviews

3

Answers

4.8

Rating

2

Courses

Instructor Introduction

Hello.
I am a Doctor of Electronic Engineering (current professor) who researches and teaches electronic circuits and embedded systems.

I have experienced various industrial fields, including Samsung Electronics, R&D at small and medium-sized enterprises, and conducting government R&D projects. Currently, I teach electronics and AI at a university while researching hardware design and embedded systems with my students.

While teaching numerous students over the years, I discovered a common problem they all shared.

Many people can write programs using development boards like STM32, ESP32, or Nordic, but the issue is that they do not clearly understand how the development boards themselves are actually made.

While you can follow and replicate circuits from the internet, it is difficult to develop new products on your own if you do not understand why they were designed that way.

That is why I created this course.

In this course, instead of simply copying the circuit diagrams,

  • why such circuits are used

  • how to select components

  • how to design PCBs

  • how actual products are manufactured

You will learn these together and directly experience the entire process of completing a single development board.

I value "learning by doing" more than difficult theories.

By the time you finish this course, you will not be just someone who uses development boards, but

an engineer who can design and produce your own electronic circuits and development boards


Key Experience

  • Ph.D. in Electronic Engineering

  • Worked at Samsung Electronics

  • Executing government R&D projects

  • Electronic Circuit and Embedded System Development

  • STM32-based hardware design

  • PCB design and product development

  • University Lectures in Electronics and AI

  • Conducting industry-academic cooperation and corporate technology development


Areas of Interest

  • Electronic Circuit Design

  • PCB Artwork Design

  • STM32 and Embedded Systems

  • Sensors and IoT Systems

  • Digital Healthcare Device

  • AI-based Embedded Systems

  • Product development and mass production

More
Published: 
Last updated: 

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

jungukko5750's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Limited time deal ends in 5 days

$13,200.00

90%

$102.30