15: 8 GPIO modes and other resources

Table of contents

1: GPIO

1: Resume

2:Mode

3: Bit structure

4:Eight modes

A: Floating/pull-up/pull-down input

B: Analog input ----GPIO_Mode_AIN

C: Open drain/push-pull output

D: Multiplexed open drain/push-pull output

E: Pattern summary 

2: Other resources 

1: On-chip resources/peripherals

2: Pin definition table


1: GPIO

1: Resume

        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 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.

2:Mode

Input: IO sends a signal to 32, that is, the peripheral sends a signal

   GPIO_Mode_AIN -----Analog input
  GPIO_Mode_IN_FLOATING -----Floating input
  GPIO_Mode_IPD -----Pull-down input
  GPIO_Mode_IPU ------Pull-up input

Output: 32 sends a signal to IO, that is, the peripheral receives the signal
  GPIO_Mode_Out_OD ----Open-drain output
  GPIO_Mode_Out_PP ------Push-pull output
  GPIO_Mode_AF_OD ----Multiplexed open-drain output
  GPIO_Mode_AF_PP ---- Multiplexed push-pull output

3: Bit structure

4:Eight modes

A: Floating/pull-up/pull-down input

 Pull-up input: VDD is closed. Default high level EG: 

        01:STM32 lighting master and buzzer------Four: Button control LED

        02:STM32--EXTI external interrupt-------A: External infrared sensor counter

        02:STM32--EXTI external interrupt-------B; rotation encoding counter

        03:TIM timer-------A: timer external clock

        06:TIM timer function------Encoder interface function-------A: Encoder interface speed measurement

         06:TIM timer function------Encoder interface function-------B: Encoder interface counting

 Pull-down input: Vss closed, default low level

 Floating input: If there is no default level, the level is uncertain

B: Analog input ----GPIO_Mode_AIN

So only the red line can go through; the analog input is also called the exclusive mode of the ADC.

        07:STM32----ADC analog-to-digital converter------A: AD single channel

        07:STM32----ADC analog-to-digital converter------B:AD multi-channel

        08:STM32----DMA data transfer---------  B:DMA+AD multi-channel

C: Open drain/push-pull output

 Open-drain output: This P-MOS is invalid---only the low level has driving ability, and the high level has no driving ability;  it can be used as the driving method of the communication protocol.   In the case of multi-machine communication, this mode can avoid the failure of each device interfere with each other

        ​​​​​​10:STM32------I2C communication----- A: Software I2C reading and writing MPU6050

        ​​​​​​10:STM32------I2C communication----- B: Hardware I2C read and write MPU6050

Push-pull output (GPIO_Mode_Out_PP): Both P-MOS and N-MOS are valid----Push-pull output has driving capabilities at high and low frequency

EG: 01:STM32 lighting master and buzzer-----1: ​​Light up 1 LED

        01: STM32 lighting master and buzzer-----2: LED flashing

        01: STM32 lighting master and buzzer-----Three: LED running light

        01:STM32 lighting master and buzzer-----5:Buzzer

        01: STM32 lighting master and buzzer-----Six: Photoresistor control buzzer

D: Multiplexed open drain/push-pull output

 Multiplexed output, pin level is controlled by on-chip peripherals

Multiplexed push-pull output: 04:TIM timer function---output comparison function (PWM)-----A: PWM drive LED breathing light

                        04:TIM timer function---output comparison function (PWM)-------B: PWM drive servo

                        04:TIM timer function---output comparison function (PWM)-------C: PWM drive DC motor 

                        05:TIM timer function------input capture function-------A: input capture function to measure frequency

                          05:TIM timer function------input capture function-------B: PWMI mode frequency duty cycle measurement

                        09:STM32-------USART serial communication + serial data packet----- 2: Serial sending + receiving-----Query code

                         09:STM32-------USART serial communication + serial data packet-----  4: Serial transmission + reception-----interrupt code

                   09:STM32-------USART serial communication + serial data packet-----A: Send HEX data packet---fixed data length

                         09:STM32-------USART serial communication + serial data packet------B: Send text data packet---data length 

E: Pattern summary 

2: Other resources 

1: On-chip resources/peripherals

We are using STM32F103 series chips, so there are no resources in the red circle 

2: Pin definition table

Guess you like

Origin blog.csdn.net/m0_74739916/article/details/133465490