One of my ways to learn new knowledge is:
1. Grasp the framework, content, and scope of the new things;
In short: Clarify the architecture and grasp the key points;
2. When looking at the knowledge involved in the framework of Chu Da, measure which of the following are the things I need to learn (the key points) and which are the things I can learn later;
In short: Go to what I need and use it for me;
3. Based on the theory, master the theoretical knowledge, and apply it to better understand these knowledge points;
In short: practice the truth;
Disclaimer: This article is part of the reference from "stm32 self-study notes set".
Lecture 1:
Stm32 is one of the Cortex-M3 series, while the Cortex-M3 processor uses the ARMv7-M architecture.
System Architecture:
We hope you will pay attention to the AHB Bus, which runs through all peripherals. We can see that AHB is bridging and almost all peripherals are controlled by apb1 and apb2;
We hope you will pay attention to the AHB Bus, which runs through all peripherals. We can see that AHB is bridging and almost all peripherals are controlled by apb1 and apb2;
& Apb2 is a high-speed device. It controls peripherals such as ADC, gpio, exit, and tim1)
& Apb1 is a low-speed device. It controls peripherals such as DAC, timx, usart, and I2C)
Firmware Library functions:
Stm32 has two types of software development methods: User library and user library;
Let's talk about database development:
Firmware Library function: This function library is a firmware function package, which consistsProgramData Structure and macro composition, including all the peripheral performance features of the controller. This function also includes a description of each peripheral driver and an application instance.
By using the firmware function library, you can easily include every peripherals without having to learn more about the details. Therefore, the Firmware Library greatly reduces user programming time and development costs;
Each peripheral driver consists of a set of functions that cover all the functions of the peripheral. Each device is developed by a Universal API (Application Programming Interface, API standardizes the structure, functions, and parameter names of the driver;
Advantages of library function development: 1. the Firmware Library greatly reduces user programming time and development costs;
2. It is easy for beginners to get started. You can easily include every peripheral without having to learn more about the details.
Disadvantages: (1) lack of in-depth system architecture and understanding of register control;
(2) Low compilation efficiency and slow speed;
Advantages and disadvantages of database development: otherwise;
The function library is generally placed in the INC folder under the fwlib directory:
Getting started with the database, using registers to improve:
The following figure shows the structure of the library file:
Based on this picture, take the home project;
Application Layer softwareIs dependent onLayer 2 DefinitionAndLayer-3 related database functionsIf you do not want to use the library, you can use the registers and struct definitions in stm32f10x. h to directly operate on the registers. Library development relies on some defined functions on the third layer to directly call functions. The following describes several key header files.
Stmf10x. h: defines the chip type and peripherals, and introduces three other head files
# Include "core_cm3.h" // some declarations from arm to standardize the M3 Kernel
# Include "system_stm32f10x.h" // some external declarations of the system clock apb1 and apb2
# Include <stdint. h> // compiler and internal parameter Type Definition
Stm32f10x_it.c is specially used to store interrupt functions.
After the header file is introduced, some variable types, struct and peripheral constants related to peripherals are defined.
A STARTUP file is also needed in the project for connecting these files. Although you do not need to know about it during development, it has already been written first, however, if you are interested, you can learn how the startup process works.
A set of engineering templates based on the understanding of the software structure. The reason is that if you use a library, it will be very cumbersome to create a project. If you have a set of templates that suit your needs, it will be easy to develop.
In addition, you need to know the acronyms,
Hope you understand how to create a project template; this is useful; otherwise, read this article.ArticleIt is also a waste of time;