Step-by-Step Guide to STM32 External Interrupts

● Interrupts Interrupts play a very important role in microcontrollers. The code executes from top to bottom by default, and when it encounters conditions or other statements, it jumps to specified locations. During the execution of code in a microcontroller, unexpected situations may arise that need to be handled, which will interrupt the current code. … Read more

Detailed Analysis of GPIO Initialization Functions in STM32 HAL Library

Reminder: This article provides a detailed analysis of the functions related to GPIO configuration in the HAL library, including MX_GPIO_Init(), HAL_GPIO_WritePin(), and HAL_GPIO_Init(). At the end of the article, a description of the f1 series GPIO port registers is attached. MX_GPIO_Init() First, let’s look at the source code: void MX_GPIO_Init(void){ GPIO_InitTypeDef GPIO_InitStruct = {0}; /* … Read more

Hands-On Guide to STM32 I2C Bus

●IIC Bus 1. Concept of IIC I²C stands for Inter-Integrated Circuit, using two bidirectional lines: one Serial Data Line (SDA) and one Serial Clock (SCL). SCL: The rising edge inputs data into each EEPROM device; the falling edge drives the EEPROM device to output data (edge-triggered). SDA: The bidirectional data line is an open-drain configuration, … Read more

STM32CubeIDE Tutorial: Configuration Process

Click the blue text to follow us 0 Preface: Previously, we learned about STM32CubeIDE and provided the official download link for STM32CubeIDE. This time, we will share the basic configuration required for STM32 projects in STM32CubeIDE, including the configuration of the UART peripheral. 1. Download link for STM32CubeIDE: https://www.st.com/zh/development-tools/stm32cubeide.html Note: The image indicates a Windows … Read more

STM32 System Clock and Delay Function Initialization

STM32 has three different clock sources that can be used to drive the system clock (SYSCLK): 1: HSI oscillator clock (internal clock) 2: HSE oscillator clock (external clock, provided by the crystal) 3: PLL clock (Phase-Locked Loop clock) These devices have the following two secondary clock sources: (1) 40kHz low-speed internal RC, which can be … Read more

Summary of C Language Basics for STM32 Microcontrollers

C language is essential foundational knowledge in microcontroller development. This article lists some common C language basics encountered while learning STM32. 1 Bit Manipulation First, we will explain several bitwise operators, followed by tips for using bitwise operations. The C language supports the following six types of bitwise operations: Next, we will focus on some … Read more

Detailed Analysis of Interrupt Functions in STM32 HAL Library

Reminder: This article briefly reviews the relevant knowledge points of EXTI and NVIC, analyzing the external interrupt callback mechanism of the STM32F1 series microcontroller. Before we start, let’s review some knowledge related to EXTI and NVIC: External Interrupt/Event Controller (EXTI) For interconnect products (series 105, 107), the external interrupt/event controller consists of 20 edge detectors … Read more

Designing High Load UART Communication with STM32

1 Introduction Direct Memory Access (DMA) is a component used by the CPU to “move” (copy) data from one address space to another without CPU intervention during the data copying process. The CPU is notified once the data copying is complete. As a result, using DMA can free up CPU resources when copying large amounts … Read more

STM32 F103C8T6 System Board Reset Circuit Design Tutorial

1. Reset (1) What is Microcontroller Reset The reset of the STM32 microcontroller refers to the process of resetting the microcontroller to its initial startup state. The reset behavior causes all running programs to terminate and restores the microcontroller’s registers and functions to their initial values. The reset process provides a known starting state for … Read more