2025-02-06
STM32 Environment Setup During The Tianjin Metro Internship天津轨道交通实习:STM32 环境搭建
The first STM32 setup note from the Tianjin internship: Keil MDK, ST-Link, startup files, GPIOC13 blinking, OLED power wiring, and the first stable board loop.天津实习里的第一篇 STM32 环境笔记:Keil MDK、ST-Link、启动文件、GPIOC13 点灯、OLED 供电,以及第一次跑稳开发板。
First Day第一天
刚开始接触 STM32 时,问题都很小,也很现实:电脑能不能识别下载器,Keil 工程能不能编译,程序能不能烧进板子,LED 能不能按预期闪。Keil MDK、ST-Link、启动文件、标准外设库、工程路径、下载设置,每个单独看都不难,第一次串起来却很容易卡。
The first useful milestone was modest: connect the STM32F103C8T6 board to the PC, build in Keil, flash through ST-Link, and confirm the board by blinking the onboard LED. That small loop decided whether every later peripheral exercise had a stable base.
第一个有用节点就是把最小链路跑稳:STM32F103C8T6 接到电脑,Keil 能编译,ST-Link 能下载,板载 LED 能闪。这个小循环稳了,后面外设练习才有基础。
What I Set Up配了哪些东西
- Keil5 MDK and an STM32F103C8T6 project.
- Startup file, clock enable, and GPIO initialization.
- GPIOC13 onboard LED blinking.
- OLED power wiring and basic display output.
- Debugger download settings and register observation.
- Keil5 MDK 和 STM32F103C8T6 工程。
- 启动文件、时钟使能和 GPIO 初始化。
- GPIOC13 板载 LED 闪烁。
- OLED 的供电和基础显示。
- 调试器下载和寄存器观察。
The important part was closing the loop between the PC, IDE, programmer, and board. If that loop is unstable, every later symptom becomes hard to judge.
这里最重要的是把电脑、IDE、下载器和板子连起来。只要这个链路不稳,后面所有现象都会变得很难判断。
File文件
The public excerpt keeps GPIOB/OLED power setup, GPIOC13 onboard LED configuration, and the main blinking loop: basic GPIO and OLED loop.
公开摘录保留了 GPIOB/OLED 供电、GPIOC13 板载 LED 和主循环闪烁逻辑:basic GPIO and OLED loop。

Looking Back回头看
The confusing part at the time was the relationship between library calls and registers. GPIO_Init looks like one function call, but behind it are port mode, speed, output type, and clock configuration. The same pattern came back later with EXTI, TIM, and ADC.
当时最容易混乱的是“库函数”和“寄存器”的关系。GPIO_Init 看起来只是一行函数调用,背后其实是在配端口模式、速度、输出类型和时钟。后面看 EXTI、TIM、ADC 时,这个理解一直在用。
The result of that day was small: stable blinking and display output. For a first internship, blinking an LED was the proof that the whole development chain was alive.
这一天结果很小,就是稳定点灯和显示。但对第一次实习来说,点灯是在确认整套开发链路真的通了。