当前位置:网站首页>0 basic self-study STM32 (wildfire) -- use register to light LED -- Explanation of GPIO function block diagram

0 basic self-study STM32 (wildfire) -- use register to light LED -- Explanation of GPIO function block diagram

2022-06-29 17:20:00 Fecter11

 Insert picture description here
What I use is wildfire stm32zet6( Overbearing development board ) in total 144 One pin , and stm32vet6( Guider development board ) yes 100 One pin .
Be careful GPIO Not a pin , The pin contains GPIO.
Pins such as VCC,GND,CLK wait
 Insert picture description here
So how to view the function of the pins ?
 Insert picture description here
Find the official data book
 Insert picture description here
pin definition Is the definition of pin
high density high-density
 Insert picture description here
 Insert picture description here
For example, the above two commonly used serial ports

 Insert picture description here
 Insert picture description here
 Insert picture description here
Look from right to left
The first is the protective diode , Take the diode on the upper side as an example , If the input voltage is higher than vdd Diode on , take IO The voltage is clamped at 3.3V+ Range of clamping voltage , This protects the input .
For example :
If we want to connect a motor , The starting of the motor generates back electromotive force , The diode has not acted for a short time , So as to damage IO.
In addition, the current when starting is also very large .
So we should pay attention to when connecting the motor . Be sure to connect a drive circuit to isolate .

Push pull output :
 Insert picture description here
What we do is
 Insert picture description here
 Insert picture description here
Every time 4 One bit controls one GPIO
 Insert picture description here
How to output it specifically 0 or 1 Of ??
 Insert picture description here
Output control register by operation (ODR) To control MOS Output 3.3v or 0v.
 Insert picture description here
 Insert picture description here
 Insert picture description here
It is recommended to understand MOS tube N Tube and P The conduction condition of the tube .
The following figure shows the current flow of output high level , External output , Equivalent to pushing . This is also known as the current infusion , Inject current into the load .
 Insert picture description here
The following figure shows the current flow of output low level , Equivalent to pulling . This is also called pull current .
 Insert picture description here
MOS The internal resistance of the tube is very small , Push pull current can reach 25ma, It's bigger .

The following describes the open drain output
Open drain output can only output low level
 Insert picture description here
 Insert picture description here
What is the meaning of open drain output ?
For example, we pass through IO There's another one out there 5v The peripherals of , We just need an external pull-up VDD Change it to 5V Level matching can be achieved .
 Insert picture description here
Explain , Most of the above uses MOS tube
Complementary signals , Namely 1/0
 Insert picture description here
 Insert picture description here
The output data register corresponds to ODR
We can directly operate the output data register to achieve output 1/0
It can also be set for indirectly / Clear the write operation of the register to control the data output register to output 1/0
 Insert picture description here
bit set / reset register This is it. BSRR
low 16 Position as set Set up 1
high 16 Position as rest clear 0
 Be careful : At the same time
That is to say, if we are right BS0 and BR0 All written 1, The actual output is in BS0 Shall prevail or 1
There is also a register that can be implemented ODR Output reset operation
 Insert picture description here
 Insert picture description here

 Insert picture description here
 Insert picture description here
Input data register Input data register
 Insert picture description here
 Insert picture description here
 Insert picture description here
This pull-up and pull-down is done by BSRR Register controlled ( In this part of the video, I didn't fully understand the specific implementation methods , Wait until later )
 Insert picture description here
our IO When the input 3.3v All we can read from the register is 1/0. And Schmidt trigger , It's like a door ( I think it's just “ The threshold ”), higher than 2v Think it's high level , Output 1, lower than 1.2v It outputs 0
Input multiplexing function
 Insert picture description here
Here we add analog output
 Insert picture description here
 Insert picture description here

原网站

版权声明
本文为[Fecter11]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/180/202206291658280387.html