当前位置:网站首页>STM32 learning record 0008 - GPIO things 1

STM32 learning record 0008 - GPIO things 1

2022-04-23 18:13:00 Li Xingye

One 、GPIO working principle

Prepare information

1.1、GPIO Basic structure and working mode

1.1.1 Basic structure description

My board is 64 Pin
Chip data manual page 19 page
 Insert picture description here
STM32F103RCT6
4 Group IO mouth 16*3+2=51 One pin :

  • GPIOA0-A15
  • GPIOB0-B15
  • GPIOC0-C15
  • GPIOD0-D2
    IO The port can also be connected to peripherals
    Chip data manual page 23 page
    PA9,PA10 It's also a serial port 1 Pin
     Insert picture description here
    GPIO The basic structure :
    Chinese reference manual page 105 page
     Insert picture description here

 Insert picture description here

1.1.2 Working mode

4 Input mode :

  • Enter the float
     Insert picture description here

  • Input pull-up
     Insert picture description here

  • Type in the dropdown
     Insert picture description here

  • Analog input
     Insert picture description here

4 Output mode :

  • Open drain output
    (1) Output 1 when :
     Insert picture description here

(2) Output 0 yes :
 Insert picture description here

  • Open drain multiplexing function
    This output 1 Or 0 The situation is basically the same as that of open drain output , The difference is that the output data is obtained by the peripheral
     Insert picture description here

  • Push pull output
    (1) Output 1 when :
     Insert picture description here

(2) Output 0 when :
 Insert picture description here

  • Pull back multiplexing function
    The pullback multiplexing function here is basically the same as that of the previous open drain , The following output methods are the same , But the previous output source is different .
     Insert picture description here
    Be careful :
    Open drain output : It can output high and low levels , Connect digital devices
    Open drain output : Only strong low level can be output , High level needs to be pulled up by external resistance . The output end is opposite to the collector of the triode , To get a high level, you need to pull up the resistor , It's suitable for current drive , Its ability to absorb current is relatively strong ( commonly 20ma within )

3 Maximum turning speed :

  • 2MHZ
  • 10ZHZ
  • 50MHZ

1.2、GPIO Register description

Each group GPIO Port registers include :
Two 32 Bit configuration register (GPIOx_CRL,GPIOx_CRH)
Two 32 Bit data register (GPIOx_IDR,GPIOx_ODR)
One 32 Position position / Reset register (GPIOx_BSRR)
One 16 Bit reset register (GPIOx_BRR)
One 32 Bit lock register (GPIOx_LCKR)
Chinese Reference Manual 113 page
 Insert picture description here
Chinese Reference Manual 114 page
 Insert picture description here
Chinese Reference Manual 115 page
 Insert picture description here

 Insert picture description here
 Insert picture description here

1.3、STM32F10x GPIO Pin description

(1) Port multiplexing function
What is reuse , Simple understanding , It's just that a man's language talent is very good , chinese 、 english 、 Korean 、 He can speak Thai , His boss, Mr. Hui, can only speak Chinese , But the business is very big , Running all over the world . Just hire him as an interpreter . When the boss goes to England on business , He translated English for the boss ; When the boss goes to India on business , He translated Thai for his boss , This function is configured by him , Then he will translate whatever language the boss wants him to translate , and STM32 Of IO What functions does the port have? We can find it in the chip data manual , Then you are its boss , If you want him to realize what function, he can realize what function !
The biggest function of reuse is to maximize the use of IO Oral resources !!! And the boss wants to hire employees who know everything !
Chip data book 30 page
 Insert picture description here

(2) Port remapping function
What is port remapping , President Hui is on a business trip to Sanya , I didn't expect to meet a Malaysian customer , I really want to order the products of Hui head office , But this man speaks Malay , And President Hui didn't take Daxiong on this business trip , But only the Secretary Xiao Lan , So Xiaolan Weihui always said through an idea , President Hui and I are on a Bluetooth phone , Then you communicate with customers , I'll act as your interpreter temporarily , Communicate with customers . In the process , Xiao Lan uses certain technical means to translate Da Xiong's translation function , Give it to yourself temporarily , Is to realize the remapping of translation function , about IO Mouth is the original A9,A10 Serial port 1 function , From new mapping to PB6,PB7 Pin .
Chip data book 33 page
 Insert picture description here
Chip data book 35 page
 Insert picture description here

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