Each GPI/O port has two 32-bit configuration registers (GPIOx_CRL, GPIOx_CRH), and two 32-bit data registers
(GPIOx_IDR and GPIOx_ODR), a 32-bit/reset register (GPIOx_BSRR), a 16-bit reset register
(GPIOx_BRR) and a 32-bit lock register (GPIOx_LCKR).
According to the specific hardware characteristics of each I/O port listed in the data sheet, each bit of the GPIO port can be configured separately by software
Multiple modes.
─ Enter floating
─ Input pull-up
─ Input drop down
─ Analog input
─ Open drain output
─ Push-pull output
─ Push-pull multiplexing function
─ Open drain multiplexing function
Each I/O port bit can be freely programmed, but the I/O port register must be accessed in a 32-bit word (half word or byte access is not allowed)
ask). The GPIOx_BSRR and GPIOx_BRR registers allow independent access to read/change any GPIO register; this
In this way, there is no danger when IRQ is generated between read and change access.
2. STM32F030 GPIO function description
According to the specific hardware characteristics of each I/O port listed in the data sheet, each
The port bits of the general-purpose I/O (GPIO) port can be individually configured by software
Several modes:
• Input floating
• Input pull-up
• Input drop down
• Simulation
• Open-drain output with pull-up or pull-down function
• Output push-pull with pull-up or pull-down function
• Alternate push-pull function with pull-up or pull-down function
• Spare function open drain with pull-up or pull-down function
Each I/O port bit can be freely programmed, but the I/O port register must be
Access as a 32-bit word, half word or byte. The purpose of GPIOx_BSRR and
The GPIOx_BRR register allows atomic read/modify access to any GPIOx_ODR.
The difference between the two:
The biggest difference between the two series is basically the difference in the position of the pull-up and pull-down resistors.
The pull-up and pull-down of the 103 series are only valid for the input channel, and the 030 series are valid for the input and output. Therefore, the 030 series can also use the pull-up and pull-down resistors when the output is floating. The floating output of the 103 series single-chip microcomputer cannot use the pull-up and pull-up. , An external resistor must be used to assist.
What impact does the structural difference of these two IOs have on actual use? The biggest difference is that when the IO is used as a bidirectional IO, it is set as a floating output. The 103 series must be configured with a pull-up resistor outside, while the 030 series can be directly configured as a pull-up open drain output, and the IO port is used as a bidirectional IO, especially It is most convenient to use in analog IIC timing!