Introduction to stm32GPIO port

GPIO (General Purpose Input Output) universal input and output port

Configurable to 8 input and output modes

 

Pin level: 0V~3.3V, some pins can tolerate 5V

In output mode, the port output high and low levels can be controlled to drive LEDs, control buzzers, simulate communication protocol output timing, etc.

In the input mode, the high and low levels or voltage of the port can be read, which is used to read key input, external module level signal input, ADC voltage collection, analog communication protocol reception data, etc.

Table 3-2 Internal structure of GPIO port

  GPIO: Stm32 transmits instructions to registers through the APB2 bus. stm32 has 32 bits, but this microcontroller only uses the lower 16 bits and does not use the upper 16 bits.

 

The face is divided into an input part and an output part. At the I/0 pin, the protection diode can prevent the circuit from inputting excessive voltage or negative voltage and drawing current for protection. The switch is a pull-up resistor and a pull-down resistor. When the pull-up resistor is set, the upper switch is closed and connected to the high level of VDD. The same is true for the pull-down resistor. This function is to ensure that it is not in a floating state. The TTL Schottky trigger (Schmitt) ensures the stability of the voltage. The upper and lower thresholds are set here. As long as the input signal is higher or lower than these thresholds, it will give corresponding high and low level signals. The analog input is mainly connected to the ADC. The multiplex function inputs are mainly serial port inputs and other peripherals.

 The function of the bit setting/clearing register in output mode is to operate a certain bit independently without affecting other bits. MOS is an electronic switch. Both push-pull output modes are working. When the register is 1, it outputs a high level, and when it is 0, it outputs a low level. They both have strong driving capabilities, and are also called strong push output modes. Open-drain output only works with N-MOS. When the register is 1, the lower tube is disconnected and in high-impedance mode. When the register is 0, the output is low level. It only has low level driving capability. Its main purpose is to avoid equipment interference. It can output 5V signal when connected to 5V externally.

This article was studied with Jiangsu University of Science and Technology. These are my study notes. If there is any infringement, please contact me to delete it!

Guess you like

Origin blog.csdn.net/m0_71827453/article/details/131754909