STM32 GPIO structure

Publisher:BlissfulDreamsLatest update time:2018-09-06 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. STM32 GPIO structure diagram 
GPIO structure diagram 
GPIO has 8 setting modes: input floating, input pull-up, input pull-down, analog input, open drain output, push-pull output, push-pull multiplexing function, open drain multiplexing function, a total of 4 inputs, 2 inputs, and 2 multiplexing functions. 
2. Mode description 
① The Schmitt trigger in the floating input 
Floating Input 
diagram is turned on, the state of the IO port can be directly sent to the input register, and the CPU can directly read the input register; 
in the above figure, the shaded part is in a non-working state, especially the output circuit in the lower half, which is actually isolated from the port. 
The yellow highlight shows the data transmission channel. The external level signal enters the STM32 through the IO port numbered 1 on the left, and is shaped by the Schmitt trigger numbered 2 and sent to the input data register numbered 3. At the other end of the input data register numbered 4, the CPU can read the level state of the IO port at any time. 
② Pull-up input 
Pull-up input 
The above figure shows the configuration of the STM32 GPIO with pull-up input mode. Compared with the previous floating input mode, only a pull-up resistor is connected to the upper part of the data channel. According to the STM32 data sheet, the resistance of this pull-up resistor is between 30K and 50K. 
Similarly, the CPU can read the level state of the IO port at the other end of the input data register at any time. 
③ Pull-down input 
Pull-down input 
④ The analog input 
Analog Input 
Schmitt trigger is closed, and the signal goes directly to the ADC input; 
The configuration of the analog input channel of STM32 is simpler. The signal enters from the port numbered 1 on the left and directly enters the ADC module from the end numbered 2 on the right. 
Here we see that all the pull-up, pull-down resistors and Schmitt triggers are in the disconnected state, so the input data register will not reflect the level state on the port, that is, under the analog input configuration, the CPU cannot read valid data on the input data register. 
⑤ Open-drain output mode 
Open-drain output 
When the CPU writes data at the number 1 end through the "bit set/clear register" or "output data register", the data bit is transmitted to the number 4 IO port through the output control circuit of number 2. 
If the CPU writes logic 1, the N-MOS tube No. 3 will be in the off state, and the level of the IO port will be determined by the external pull-up resistor. If the CPU writes logic 0, the N-MOS tube No. 3 will be in the on state, and the level of the IO port will be pulled to the zero potential of VSS by the N-MOS tube No. 3. 
In the upper half of the above figure, the Schmitt trigger is in the on state, which means that the CPU can monitor the status of the IO port at any time at the other end of the "input data register"; through this feature, the virtual IO port bidirectional communication is also realized. As long as the CPU outputs logic 1, since the N-MOS tube No. 3 is in the off state, the level of the IO port will be completely determined by the external circuit. Therefore, the CPU can read the signal of the external circuit in the "input data register" instead of the logic 1 output by itself. 
In the output mode of the GPIO port, there are 3 output speeds to choose from (2MHz, 10MHz and 50MHz). This speed refers to the response speed of the GPIO port drive circuit, not the speed of the output signal. The speed of the output signal is related to the program (the chip has arranged multiple output drive circuits with different response speeds in the output part of the IO port. Users can choose the appropriate drive circuit according to their needs). By selecting the speed, different output drive modules can be selected to achieve the best noise control and reduce power consumption. High-frequency drive circuits also have high noise. When high output frequency is not required, please use low-frequency drive circuits, which is very helpful to improve the EMI performance of the system. Of course, if you want to output a higher frequency signal, but choose a lower frequency drive module, you may get a distorted output signal. 
⑥ Open-drain output multiplexing function 
Open-drain output multiplexing 
⑦ Push-pull output mode 
Push-pull output 
⑧ Push-pull multiplexing output mode 
Push-Pull Multiplexing 
GPIO push-pull multiplexing output mode, the input of the output control circuit No. 2 is connected to the output end of the multiplexing function. At this time, the output data register is disconnected from the output channel and connected to the output signal of the on-chip peripheral. After we configure GPIO to multiplex output function, if the peripheral is not activated, its output will be uncertain, and the other parts are consistent with the above mode, including the reading of "input data register". 
3. Application scenarios 
① Pull-up input and pull-down input can be used to detect external signals; for example, buttons, etc.; 
② Floating input mode, due to the large input impedance, this mode is generally used for the receiving end of I2C and USART of standard communication protocols; 
③ Ordinary push-pull output mode is generally used in the occasions where the output level is 0 and 3.3V. The ordinary open-drain output mode is generally used in the occasions where the level does not match. For example, if you need to output a high level of 5V, you need an external pull-up resistor, the power supply is 5V, and the GPIO is set to open-drain mode. When the output is in high impedance state, the pull-up resistor and the power supply output 5V level to the outside. 
④ For the corresponding multiplexing mode, it is selected according to the multiplexing function of GPIO. For example, if the GPIO pin is used as the output of the serial port, the multiplexing push-pull output mode is used. If it is used in IC, SMBUS and other occasions where line and function are required, the multiplexing open-drain mode is used. 
⑤When using any open-drain mode, a pull-up resistor is required.

Keywords:STM32 Reference address:STM32 GPIO structure

Previous article:STM32 GPIO port input mode configuration example
Next article:Problems with setting pull-up and pull-down in GPIO_PuPd register in STM32F4

Recommended ReadingLatest update time:2024-11-16 20:57

Research on STM32 Timer
I have always wanted to write an article about counting, but my level is limited and I have never been able to write it. But I will just write this one! ! ! I have seen the STM32 timer before, but I still feel it is in a very vague state. This time I will treat it as my first attempt to learn how to write technical art
[Microcontroller]
STM32GPIO external interrupt summary
1 STM32 interrupt grouping Each GPIO of STM32 can be configured as an external interrupt trigger source, which is also the strength of STM32. STM32 divides many interrupt trigger sources into different groups according to the pin numbers. For example, PA0, PB0, PC0, PD0, PE0, PF0, PG0 are the first group, and so on.
[Microcontroller]
STM32 study notes-window watchdog
1. Window Watchdog (WWDG): Usually used to monitor software faults caused by external interference or unforeseen logic conditions when the application deviates from the normal operating sequence. 2. Window watchdog working diagram: T is the lower seven bits of WWDG_CR, and W is the lower seven bits of WWDG- CFR
[Microcontroller]
STM32 study notes-window watchdog
stm32 quick learning 4 - serial port sending characters
Set UART1 clock Set the send pin function Serial port settings, enable #include "stm32f10x.h"   void RCC_Configuration(void); void GPIO_Configuration(void); void USART_Configuration(void);   unsigned char str ="A"; int main(void) {   RCC_Configuration();     GPIO_Configuration();     USAR
[Microcontroller]
STM32 CAN bus usage
This debugging uses the STM32 core board of Zhuhai D-Chip Technology. This core board contains a CAN bus driver. It can easily connect and communicate with multiple industrial devices at the same time. The CAN bus of the STM32 processor has multiple working modes. This test is in normal mode. To use it in normal mod
[Microcontroller]
How is the data of each ADC defined in the memory of stm32 multi-channel ADC+DMA?
#define N 50 //50 samples per channel #define M 7 //7 channels uint32_t ADC_ConvertedValue ; DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&ADC_ConvertedValue; DMA_InitStructure.DMA_BufferSize = N*M; //DMA channel DMA buffer size Here DMA knows to put data into ADC_ConvertedValue and the SIZE of the buffer. When the
[Microcontroller]
[STM32 motor square wave] Record 3——TIM1 time base initialization configuration
Timer classification: In the STM32F1x series, except for the interconnected products, there are a total of 8 timers, which are divided into basic timers, general timers and advanced timers. The basic timer TIM6 and TIM7 are 16-bit timers that can only count up and have no external IO. The general timer TIM2/3/4/5 is a
[Microcontroller]
[STM32 motor square wave] Record 3——TIM1 time base initialization configuration
STM32 Quick Start Tutorial
Development and compilation software : IAR  EWARM  4.42A  JTAG tool:           ST-LINK2 (development board comes with it) Development board:                Wanli  STM32EK (199 yuan) Recommended materials : "STM32F10X-128K-EVAL MCU"  Circuit  diagram of ST's STM32 development board "STM32 Technical Reference Man
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号