Tutorial to ARM(STM32)[Effective method for ARM beginners]

The explanation is based on STMicroelectronics' STM32F1xx series (Cortex-M3), which has an ARM core mounted on an embedded Microcontroller(MCU) in "Tutorial to ARM(STM32)".
This site explains the following know-hows such as knowledge of MCU that is indispensable for mastering this MCU, basic engineering knowledge such as electronic circuits necessary for understanding the hardware and software around MCU, detailed functions of the MCU, and applications using MCU and the system design for development.

It seems difficult to learn everything when you write it out like this, but I think that you will learn it if you proceed with the learning one by one.

Now let's enter the embedded world.

Table of contents

Microcontroller used for embedded systems

This chapter explains the concept of the microcontroller, which is the core of embedded technology, as well as a summary of the basic knowledge surrounding the microcontroller and the tools that are necessary to promote development.

What comes to mind when you think of embedded systems?

Embedded systems are specialized computer systems with specialized functions that are built into various devices as opposed to general-purpose computer systems such as PCs and tablets. The following are just a few of the devices that come to mind with embedded systems

  • Home appliances (refrigerators, washing machines, ceiling lights, etc.)
  • AV equipment (TV, video, audio, etc.)
  • Communication equipment (smartphones, landlines, etc.)
  • Transportation equipment (cars, trains, etc.)
  • FA equipment (industrial robots, conveyor systems (PLC), etc.)
  • Entertainment equipment (game machines, pachinko machines, etc.)
  • Office automation equipment (printers, scanners, copiers, etc.)
  • Measuring instruments (oscilloscopes, electricity meters, gas meters, etc.)

Almost all of today's electrical equipment, from the smallest to the largest, probably incorporates embedded technology. In fact, it is rare to find a device without embedded technology.

The point

In short, an embedded system is a computer system that uses a MCU (microcontroller) to control output to devices based on input information from sensors, switches, etc., while hardware and software work closely together to achieve specialized functions.
The term "MCU" will be explained in more detail later.



Here we have the concept of hardware and software. Hardware is the physical, tangible thing such as switches and electrical/electronic circuits that we can see and touch directly.

In an embedded system, software is a program inside the on-board MCU that configures various functions to control the hardware. It is not something that is physically visible.

Without software, embedded devices are simply non-functional objects. Conversely, even the best software is useless without high-performance hardware that can take advantage of it.

It is very important for engineers working with embedded technology to have the skills to create systems that integrate both hardware and software in a well-balanced manner.

If you say that you are not an expert in anything other than software and leave hardware-related matters to others, you will not be able to configure an excellent system.

Many of them explain MCU operation with a focus on programming as an embedded technology, but neither programming nor MCU itself is an embedded technology itself, but only a partial means to an end. The ultimate goal is to acquire design techniques and practical skills to develop various applications using MCUs.


The reason why people say that the threshold for embedded technology is high is because it requires the ability to put together a wide range of knowledge, including electrical and electronic engineering, mechanical engineering, and control engineering, in addition to software programming skills.

However, there is nothing to be afraid of, for example, knowledge of electrical and electronic engineering is not a highly specialized subject, but rather just understanding and designing a few practical circuits.

The important thing is to understand the fundamentals of each field, in other words, to understand the essence of each field, not to pursue specialization.

The process of understanding and acquiring knowledge of basic principles, such as simple circuits, is enjoyable because you can feel that your ability is growing. As your curiosity grows, your wisdom will also grow and develop, and your ability will improve even more.

The process of understanding and acquiring knowledge of basic principles, such as simple circuits, is enjoyable because you can feel that your ability is growing. As your curiosity grows, your wisdom will also grow and develop, and your ability will improve even more.

For example, control engineering (feedback control), which is very reassuring to learn in embedded technology, is good example. It is really difficult to understand what is written in specialized books because of the world of mathematics. If you don't have the basics, it is almost impossible to learn on your own. Even if you understand it, you will not be able to actually use it.

It is also sufficient to capture only the important essence and use only a portion of it for practical purposes. If you want to become more specialized, it is better to gain some experience and understand the basic principles.

It is not easy to learn embedded technology that can be used in a wide range of fields in a short period of time, but it can be learned efficiently.

Although a certain amount of experience and achievement are necessary to realize real ability, it can be developed to any extent as long as the essence is captured and a grounding in basic principles is established.

While it is important to choose a MCU for those interested in embedded technology, you will gain skills efficiently and steadily if you use the system employed on this site to learn.
The Arduino, which is very popular for electronic works, and Mbed, the ARM development environment, are systems that trigger the handling of microcontrollers, but I will introduce the following systems.
Please refer to "Why recommend STM32 Nucleo instead of Arduino for beginners in MCU learning?" for a customized system for learning microcomputers on this site.

What is MCU

What you need to know before learning MCU embedded technology

MCU selection

Development Environment and Tools

About the Teaching Material Board

MCU and C language

The point

The site contains know-hows that will help aspiring embedded engineers acquire the essence of embedded engineering in as little time as possible.
I hope that as many embedded engineers as possible will grow up from here, and I would like to support them.

Basics of Embedded Technology

This chapter explains the fundamentals essential for learning embedded technology. It introduces the concepts of analog and digital, as well as the circuits that make up the computer's periphery, so please make sure you have a good understanding of these concepts.

"Do I need any prior knowledge before learning about microcontrollers?"

So far, I have focused on the concept of MCU and specifics for MCU development. I will now cover the essentials of basic electrical and electronic knowledge that you need to know before you start learning about MCU in advance.

This is a very important area because it is the part where embedded technology is said to require knowledge of hardware as well as programming. For example, the circuitry of the IO port that exchanges signals with MCU, what kind of signals are handled, and what kind of structure is used.


Input signals are taken into MCU from hardware such as sensors through a circuit called an interface. After MCU acquires the signals, digitizes them, processes them in a program, and then outputs them again to the outside world via an interface for some kind of processing in an embedded system. For this reason, it is necessary to understand the specific circuits and peripheral hardware.


It is also important to have an understanding of analog and digital technology in order to understand the interface part as well as hardware knowledge such as circuits. I hope that you will always remember that you are dealing with concrete objects when they create programs.

MCU system

As our understanding of MCUs has advanced, interface design is very important in actual development. MCU and its surroundings are composed of electrical and electronic circuits, and if the design is inadequate, it will not only not function, it will break. However, it is not so easy to break if you keep in mind the essential points of what you must not do.

Typical examples of what should never be done are unintentional short circuits and reverse power supply polarity. Short-circuiting or reversing the polarity of the power supply will cause an overcurrent, resulting in abnormal heat generation and destruction. Protection circuits are installed to reduce the probability of such accidents.

Actual products have redundant (extra) circuits in addition to the basic circuits shown in the textbooks, because of the various things that can happen. The key to designing a circuit that meets the specifications is to select components with a sufficient current value that does not exceed the rated value, etc. At the same time, it is important, especially for embedded components, to select components with a response speed that can adequately respond to input/output signals.

Based on the above, let's go over the basics of the electrical and electronic circuits used around MCU and the basic structure of the program.

Analog and Digital

Digital Details

Number of bits in MCU

About Bits, Bytes, Words and Digital Logic

Basic circuits used around MCU

About Puls

The point

It is very important to understand the basics of electrical and electronic circuits in order to understand the operation of MCUs.  The shortcut to understanding is to learn not with abstract concepts but with concrete, practical circuits. This site explains the basics of circuits that are essential for understanding MCUs in detail, so please study them carefully.

What are MCU peripheral functions (peripherals)?

What are the peripheral functions (peripherals) built into MCU?

MCU contains a CPU, ROM, RAM, I/O, and manufacturer-specific circuits called peripherals.

MCU architecture

The CPU is called a central processing unit (CPU) and plays the role of a control tower, or brain, in a MCU. It executes commands sequentially according to a program, reads data from the input port, and sends signals to the output port at intervals measured by a timer while displaying a monitor display using the communication function of the peripheral functions.

MCUs thus incorporate timers, communications, AD/DA converters, and other peripheral functions that are essential for home appliances, mobile phones, and other electrical and communications devices. The types of built-in peripheral functions depend on MCU, but basically, timers, AD converters, serial communication UARTs, and general-purpose input/output ports (GPIOs) are important functions that are built into any MCU, so it is easy to configure a small system if you can master these functions. The following is an example of a product that can be used in a variety of applications.

In the absence of MCUs, all of these peripheral functions were composed of hardware (analog and digital circuits), so building a single system was time-consuming, labor-intensive, and difficult. Nowadays, all of the peripheral functions are built into the MCU, so they can all be configured using software (programs) alone.

System in a decade ago

If the system is designed in anticipation of future specification changes, it will be easy to change various functions later with software modifications. This is an unimaginable convenience from the days when peripheral circuits were composed of hardware.

System with MCU

Relationship between peripheral functions (peripherals) and firmware (drivers)

Peripheral Library

How to read the register map

The point

Even though the peripheral circuits are built into MCU, they are connected to input devices such as sensors and output devices such as display monitors via interfaces. Therefore, a broad knowledge and experience in electrical/electronic circuits and hardware related to input/output devices are also required. Embedded technology requires the skills to actually make things function, which is different from those who work only with software, such as web engineers.

Details of each peripheral function (peripheral)

The STM32 MCUs are so sophisticated that it is difficult to understand all of them, but this site provides explanations of selected functions that are essential for learning embedded skills.

In this chapter, I will finally explain the details of each peripheral in the STM32F1xx series (Cortex-M3).

Although the STM32 MCU is a sophisticated one, it is not necessary to understand or master all of its functions. It is sufficient to use the functions correctly as needed. However, to do so, it is necessary to understand the peripheral functions (peripherals) of the STM32 to some extent.

For example, among peripherals, timer/counters and AD converters have so many functions that it may be difficult for beginners to know which function to select. Therefore, this site explains each peripheral starting with the most basic functions that can be used in the most basic way. I think it is best to start by confirming that the function actually works, and then gradually develop the function as you go along.

Actual operation can be checked by following the sample programs in "Application Program samples used in practice".

The functions of each peripheral are not all introduced on this site, but are excerpts that can be used in most embedded systems if only these are kept in mind, so I encourage you to learn them. Of course, more advanced functions may be necessary depending on the required specifications, but these are not covered in this site because they are necessary for professionals far beyond the beginner's level.

The reference manual of the STM32 MCU provides detailed information on each peripheral. If you have become somewhat proficient with the MCU and wish to use more advanced functions, please refer to the manual to enhance the functionality.

To master peripherals is to master peripheral libraries, and this is true whether the library is a Standard Peripheral Library (SPL) or a Hardware Absolute Layer (HAL). In other words, if you understand the functions of the SPL library used in this site for the time being, you will understand the essence of MCU functions, and of course, porting to HAL in the future will be no problem. Of course, it does not matter if you can directly manipulate registers, because you do not need the library.

This may sound a bit complicated, but I am confident that beginners will be able to understand it if they follow the steps in order. Let's begin.

General Purpose I/O GPIO

System Clock

System timer


Various interruptions

AD converter

Serial communication USART

Serial communication I2C

Serial communication SPI


Independent Watchdog timer


The library functions used in each peripheral described on this site are only some of the major ones used in using the STM32 MCU. In addition, if you want to use various functions, there is a web site that you can refer to like a dictionary that explains the firmware SPL(Japanese only). STM32 Firmware Function List

OS used in embedded systems

As an application is created, the number of functions increases and processing becomes more complex. Complex processing can be systematically programmed by using an OS. This chapter explains the concept of an OS, describes the RTOS used for embedded applications, and introduces specific usage.


For relatively simple processes such as the sample programs for each peripheral introduced so far, it is sufficient to divide the contents of each process into blocks and execute them sequentially.


In a system consisting of inputs from operation switches, sensors, etc., and outputs to display screens, motors, etc., multiple processes using peripherals are combined to use these inputs and outputs. In order for the system to function efficiently, each of these processes must be executed simultaneously, and the execution frequency and priority must be set arbitrarily.


Therefore, an OS suitable for embedded systems is introduced to manage each process. This OS suitable for embedded systems is called a real-time OS (RTOS), which can easily realize so-called multitasking.


It is like a light add-on software, and once the pattern is configured according to the rules, it can be easily adopted for each application program. It is recommended to introduce it at an early stage.


This site provides explanations of real-time operating systems (RTOSs), especially those that are essential for practical use. Since the purpose of this site is to use RTOSs in actual applications, explanations are given in a programmatic manner without using too many technical terms. I hope that you will learn to use it as soon as possible and make full use of it.

Realtime OS


Task management


Embedded Development Design

Being able to operate MCU through programming is not sufficient in practice. In actual development, the process of design is necessary. The work to be done is explained step by step in an easy-to-understand manner, so please take your time and work on it carefully.

So far, I have discussed peripheral interfaces and MCU peripherals for operating it. This is the part with many software elements that I will be focusing on programming.

In order for an idea to come to mind and take shape, it must be designed. This chapter explains the steps from the concept of design to the point where the final operation can be confirmed.

Knowledge and experience of hardware is especially necessary for embedded technology, especially in the design phase. Software can be utilized only with properly designed hardware, so please make sure to learn the basics of design.

System design

Hardware design

Software design



External Clock

Poser supply

IoT of MCU

Equipped with IoT-enabled technology in embedded products expands the range of applications.

Here, I explain the procedure for installing the wireless function (WiFi) by the wireless module ESP32, which is the easiest starting point for converting the microcomputer to IoT.

Applications using WiFi are useful for consumer devices such as hobby applications and PC printers, but devices that require industrial-level robust performance are required to be incorporated into a wired LAN system. This site introduces a LAN module that can be easily retrofitted to the STM32F1xx series of microcomputers that do not support Ethernet, communication using TCP sockets, and a method of communicating from a browser with an HTTP server installed.

The IoT is something like the Internet of Things, and until now the products functioned independently in various fields, but nowadays, the products are connected to the network regardless of whether they are wired or wireless, and a little remote operation is performed. It has become possible to manage products via the Internet, for example, on a smartphone.

The word IoT itself is very abstract and difficult to understand, but by connecting products to the network, it has development potential that was unthinkable in the past. It can be said that it is essential for future embedded products to support IoT.

This site introduces the one using the wireless module that can easily make the existing embedded system compatible with IoT. The wireless module itself has a built-in MCU, and the WiFi protocol stack and Bluetooth protocol can be used only by serial communication, so it is relatively easy.

Regarding wired LAN, it is quite complicated how to use the communication protocol stack consisting of software on the condition that the MCU itself is compatible with Ethernet, and STM32F1 does not support it. It can be achieved relatively easily by using an Ethernet-enabled MCU represented by STM32F4 series, an automatic code generation function, and a HAL library development environment, but it is still necessary to know the basic usage of the protocol stack such as socket communication.

In my experience, it was necessary to somehow make the existing system commercialized in the STM32F1 series compatible with Ethernet, then I used WIZnet's W5500 TCP/IP controller IC to make it compatible with Ethernet externally. This IC has a built-in TCP/IP protocol stack as hardware, so it can be used with relatively simple code. This can be achieved if the communication interface SPI can be used.

With SPI communication specifications, the use of an external controller for Ethernet-based MCUs is a bit difficult for electronic work applications, but if it is made, it will become a powerful asset in the future.

This site deals only with those using W5500, but since the basic handling of communication protocols is the same, once you understand it, you will be able to crush other LAN controllers as well.

Once the TCP socket communication system is built, it is possible to install a higher-level HTTP protocol on the software, and even to install WebSocket for two-way real-time communication with the browser.

At this point, MCU skills required by the world are almost grasped, so I think we can challenge infinite possibilities by combining skills.

Basics of wireless LAN (ESP32 module)

WiFi remote control using a browser

Ethernet compatible system design of MCU

Socket communication that implements a TCP server

MCU system equipped with a WEB server configured with the HTTP protocol

Real-time communication between a browser and MCU using WebSocket

Ultra-highspeed real-time monitor of WebSocket on Microcontroller


Home appliances such as mobile phones, TVs, and printers are generally equipped with WiFi and controlled wirelessly, and the word "wired LAN" seems to be outdated, but it is "wired" limited to consumer products.  For products for industrial equipment, the LAN must be wired to form a network at the manufacturing site where the operating environment conditions are harsh, and the equipment that may be exported can be easily specified by the radio law of each country. There are some circumstances that cannot be handled. From a security perspective, not everything will be easily replaced by wireless.

Follow me!