当前位置:网站首页>STM32 Basics

STM32 Basics

2022-04-23 20:04:00 Flowers bloom in half ོ

First of all, you must be familiar with stm32(stm32g431rbt6) The layout of the board

In fact, you can probably remember what is in which position .

Then there is the schematic diagram , Be familiar with the functions of each pin

 

above DAP Link and The goal is MCU These two things on the board , By that LCD For blocking the

Let's look at the naming rules of chips

Actually sum 51 Or is it 15 Almost .15、51 All are 8 Bit MCU , Each address is composed of 8 Bit composition , The address can be expressed as :0x_ _, and 32 yes 32 Bit , The address can be expressed as :0x_ _ _ _ _ _ _ _, therefore 51、15 Up to 255 The address of , and 32 You can visit 4G The address of .

Let's see below. stm32 internal structure

The red circle is equivalent to the inside CPU, Then connect various resources through the bus , There are two buses AHB1 and AHB2, Hanging all kinds of resources , It's going to look down , You should be able to understand its internal distribution .( In that case , It's like a map , Which one are you looking for , Follow the line , Or like a human body system )

To write stm32 The program must first use STM32CubeMX Automatically generate some underlying code , The first step is to configure the clock , When I first saw the clock configuration interface, I was actually afraid , Because I can't understand ( In distress situation )...
Take a look at the picture below

 

However, you can still understand it by following the vine and feeling the melon , Ellipses of the same color indicate that they are the same . It's a green oval , It can be seen that ,  We use a high-speed external clock , that stm32 The system clock passes through the high-speed external clock and the high-speed internal clock PPL Give the configuration to the main frequency

therefore , When we configure the clock mode .

The clock configuration is also clear at a glance

stm Internal resource address ( Storage address )

SRAM Initial address :0X2000 0000

Peripheral start address :0X4000 0000

flash Initial address :0X0800 0000

I don't know much about anything lower ..

HAL Kuhe LL library :

HAL library (Hardware Abstraction Layer) yes ST The new programming library highly praised by the government ,HAL Kuo is ST by STM32 The latest abstract layer embedded software , It can better ensure cross STM32 Maximum portability of the product .HAL Used a relatively large Flash and SRAM.

LL library (Low Layer) yes ST Recently added Library , And HAL Bundled release , Documents are also and HAL Documents together LL The library is closer to the hardware layer , Not applicable to peripherals requiring complex upper layer protocol stack , Direct operation register . It supports all peripherals . Usage method : Independent use , The library is completely independent , Can completely put aside HAL library , Only LL Library programming is complete . Making STM32CubeMX Project generation , Choose... Directly LL Library is enough . If complex peripherals are used , for example USB, It will call HAL Library mixed use , and HAL Libraries are used in combination . After compiling LL The library only has HAL Library 33% Volume .

版权声明
本文为[Flowers bloom in half ོ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231947187677.html