当前位置:网站首页>Eight working modes of stm32gpio and chip naming rules
Eight working modes of stm32gpio and chip naming rules
2022-07-03 09:41:00 【two thousand and twenty-one point zero nine】
One 、STM32 Chip naming rules

Two 、GPIO Eight working modes
Enter the float
Input pull-up
Type in the dropdown
Analog input
Open drain output
Push pull output
Push pull multiplexing
Open drain taking function
1、 Enter the float
Floating space , As the name suggests, floating in the air , It goes up with a rope , Below with a rope to pull down .
Floating input is usually used for external key input , Combined with the input circuit on the diagram , I understand it as floating input state ,IO The level state of is uncertain , It's all up to external input , If the pin is suspended , Reading the level of the port is uncertain .

2、 Input pull-up

3、 Type in the dropdown

4、 Analog input

5、 Open drain output

6、 Push pull output

7、 Push pull multiplexing

8、 Open drain multiplexing function

Floating space , As the name suggests, floating in the air , It goes up with a rope , Below with a rope to pull down .
Open a leak , It's like the output is connected to NPN triode , And only took e,b. c extremely It's open , You can connect a resistor to 3.3V, You can also connect a resistor to 5V, such , At output 1 When , It could be 5V voltage , It can also be 3.3V The voltage is on . But when it's not connected to the resistor pull-up , This output is too high to be realized .
Open a leak Output : The output is equivalent to the collector of triode . To get a high level state, you need to pull up the resistor . It is suitable for current drive , Its ability to absorb current is relatively strong ( commonly 20ma within ).
The open drain circuit has the following characteristics :
1. Using the driving power of external circuits , Reduce IC Internal drive . When IC Inside MOSFET Conduction time , The driving current is from the outside VCC Flow through R pull-up ,MOSFET To GND.IC Only a very low gate drive current is needed inside .
2. Generally speaking , Open drain is used to connect devices of different levels , For matching levels , Because the open drain pin is not connected to the external pull-up resistance , Only output low level , If you need to have the function of output high level at the same time , You need to connect the pull resistance , A good advantage is by changing the voltage of the pull-up power supply , The transmission level can be changed . For example, the pull-up resistor can provide TTL/CMOS Level output, etc .( The value of the pull-up resistor determines the speed of the edge of the logic level conversion . The greater the resistance , The lower the speed, the lower the power consumption , So the choice of load resistance should consider both power consumption and speed .)
3. OPEN-DRAIN Provides a flexible way to output , But there are also weaknesses , It's the delay that brings the rising edge . Because the rising edge is through external pull-up passive resistance to charge the load , So when the resistance is selected, the delay is small , But the power consumption is high ; On the contrary, the delay is large and the power consumption is small . So if there is a requirement for delay , It is recommended to use the falling edge output .
4. Multiple open drain outputs can be Pin, Connect to a line . Through a pull-up resistor , Without adding any devices , formation “ And logic ” Relationship . This is also I2C,SMBus The principle of judging the occupied state of the bus . Add : What is? “ Line and ”?:
At a node ( Line ) On , Connect a pull-up resistor to the power supply VCC or VDD and n individual NPN or NMOS The collector of a transistor C Or leakage D, The emitters of these transistors E Or source S It's all connected to the ground , As long as one transistor is saturated , This node ( Line ) It's pulled to the ground level . Because the base of these transistors injects current (NPN) Or grid plus high level (NMOS), The transistor will saturate , So these bases or gates are very important to this node ( Line ) The relationship between right and wrong NOR Logic . If this node is followed by an inverter , It's or OR Logic .
In fact, it can be simply understood as : When all the pins are connected , Connect an external pull-up resistor , If there is a pin output for logic 0, It's equivalent to grounding , A circuit in parallel with it “ It's equivalent to being short circuited by a wire ”, So the logic level of the external circuit is 0, Only for the high electricity , The result of and is logic 1.
push-pull , It's push and pull , anytime IO The level of each port is certain , No external pull-up or pull-down resistor is required .
push-pull The circuit is two triodes with the same parameters or MOSFET, Exist in the circuit in push-pull mode , They are responsible for the amplification of positive and negative half cycle waveforms , When the circuit is working , Only one of the two symmetrical power switches is on at a time , So the conduction loss is small 、 Efficient . The output can supply current to the load , You can also draw current from the load . The push-pull output stage improves the load capacity of the circuit , And increase the switching speed .
because Floating input Generally used for external key input , Combined with the input circuit on the diagram , I understand it as floating input state ,IO The level state of is uncertain , It's all up to external input , If the pin is suspended , Reading the level of the port is uncertain .
Pull up input / Drop down input / Analog input :
First of all, the purpose of up and down is to IO Set a default state , For example, if the key control is enabled , If the key is pressed, the high level is effective , Let's pull down , Let the IO The port is at low level by default ( That is, when no key is pressed IO The port always detects a low level , Only when the key is pressed IO Eloquence will detect a high level ); If the key is pressed, the low level is valid , Let's pull up , Let the IO The port is at high level by default ( That is, when no key is pressed IO The port always detects a high level , Only when the key is pressed IO Eloquence will detect a low level ).
It's a little twisted , Simplify understanding : Is to make GPIO We know that the input pin can have a certain level signal without an input signal , Pull up is the high level ( Because the pull-up input has a resistor inside the chip, and one end is connected to VCC, Pull down is the low level ( Because the pull-down input has a resistor inside the chip, and one end is connected to GND).
Like here KEY0/KEY1 Key , When not pressed , Because one end is connected GND And it is disconnected , Connected at the other end GPIO The pin should be configured to detect a high-level signal by default ( Only when the key is pressed, the low-level signal is detected , That is, the low level is effective ), So the key initialization is related IO To configure as a pull-up input ; and WK_UP Key , When not pressed , Because one end is connected VCC And it is disconnected , Connected at the other end GPIO The pin should be configured to detect a low-level signal by default ( Only when the key is pressed, the high-level signal is detected , That is, the high level is effective ), So the key initialization is related IO To configure as a drop-down input .
Further simplification : Pull up input refers to IO On the mouth ( Inside the chip ) String a resistor to vcc, Normal condition IO What is monitored is high level , Suitable for external grounding GND Key input of ; Drop down input refers to IO On the mouth ( Inside the chip ) String a resistor to GND, Normal condition IO Low level is detected , Suitable for external grounding VCC Key input of .( I really don't understand , Remember to use it )
Reuse open drain output 、 Multiplexing push pull output : It can be understood as GPIO The configuration when the port is used as the second function ( That is, not as a general purpose IO Mouth use )
Finally, summarize the use of :
stay STM32 Choose IO Pattern
(1) Floating input _IN_FLOATING —— Floating input , You can do it KEY distinguish ,RX1
(2) With pull-up input _IPU——IO Internal pull-up resistor input
(3) With drop-down input _IPD—— IO Internal pull-down resistor input
(4) Analog input _AIN —— application ADC Analog input , Or low power consumption
(5) Open drain output _OUT_OD ——IO Output 0 Pick up GND,IO Output 1, In the air , It needs to be connected with pull resistance , In order to achieve high output level . When output is 1 when ,IO The state of the port is raised by the pull-up resistor , But because of the open drain output mode , such IO The port can also be changed from an external circuit to a low level or constant . You can read IO Input level changes , Realization C51 Of IO Two way function .
Only strong low level can be output , The high level depends on the external resistance . The output is equivalent to the collector of triode , To get a high level state, you need to pull up the resistor , It is suitable for current drive , Its ability to absorb current is relatively strong ( commonly 20ma within ).
(6) Push pull output _OUT_PP ——IO Output 0- Pick up GND, IO Output 1 - Pick up VCC, Read input value is unknown .
It can output high and low levels , Connect digital devices .
(7) Push pull output of multiplexing function _AF_PP —— Internal and external functions (I2C Of SCL,SDA).
(8) Open drain output of multiplexing function _AF_OD—— Internal and external functions (TX1,MOSI,MISO.SCK.SS).
边栏推荐
- [CSDN]C1训练题解析_第四部分_Web进阶
- Leetcode daily question (516. long palindromic subsequence)
- LeetCode每日一题(1996. The Number of Weak Characters in the Game)
- Run flash demo on ECS
- 1922. Count Good Numbers
- Failed building wheel for argon2 cffi when installing Jupiter
- LeetCode每日一题(2305. Fair Distribution of Cookies)
- LeetCode每日一题(1024. Video Stitching)
- Nodemcu-esp8266 development board to build Arduino ide development environment
- UCI and data multiplexing are transmitted on Pusch (Part 4) --small block lengths
猜你喜欢

Spark overview

NR technology -- MIMO

Nr--- Pusch I: sorting out the agreement process

Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 2 --blinker_ Hello_ WiFi (lighting technology - Mobile App control routine)

Learning C language from scratch -- installation and configuration of 01 MinGW

How does the nr-prach receiver detect the relationship between prembleid and Ta

文件系统中的目录与切换操作
![[CSDN]C1训练题解析_第二部分_Web基础](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[CSDN]C1训练题解析_第二部分_Web基础

Flink-CDC实践(含实操步骤与截图)

LeetCode每日一题(1162. As Far from Land as Possible)
随机推荐
LeetCode每日一题(1856. Maximum Subarray Min-Product)
数字身份验证服务商ADVANCE.AI顺利加入深跨协 推进跨境电商行业可持续性发展
Failed building wheel for argon2 cffi when installing Jupiter
UCI and data multiplexing are transmitted on Pusch (Part 4) --small block lengths
NR technology -- MIMO
LeetCode每日一题(1162. As Far from Land as Possible)
LeetCode每日一题(1996. The Number of Weak Characters in the Game)
Quickly use markdown to edit articles
【順利畢業】[1]-遊覽 [學生管理信息系統]
UCI and data multiplexing are transmitted on Pusch - Part I
[csdn] C1 analyse des questions de formation Partie III Bar _ JS Foundation
Global KYC service provider advance AI in vivo detection products have passed ISO international safety certification, and the product capability has reached a new level
Convert IP address to int
Flink learning notes (10) Flink fault tolerance mechanism
[successful graduation] [1] - visit [student management information system]
Leetcode daily question (1856. maximum subarray min product)
Uncle Wang's blog directory [constantly updating]
[combinatorics] Introduction to Combinatorics (context of combinatorics | skills of combinatorics | thought of combinatorics 1: one-to-one correspondence)
小王叔叔的博客目录【持续更新中】
文件系统中的目录与切换操作