Each set of IO ports of the STM32 microcontroller has 4 32-bit configuration registers for configuring the Gpiox_moder, Gpiox_otyper, Gpiox_ospeedr, and gpiox_pupdr,2 32-bit data registers for configuring input and output registers Gpiox_ IDR and gpiox_odr,1 32-bit reset registers gpiox_bsrr,1 32-bit lock registers Gpiox_lckr and 2 32-bit multiplexing features select registers Gpiox_afrh and GPIOX_AFRL.
The output status of the Gpio can be configured as push-pull or open-drain plus pull-up or pull-down. The output data can either come from the output data register or be emitted by other peripheral registers. The speed of each set of IO ports is configurable and can be configured as 25mhz,50mhz or 100Mhz. Data input also has several modes, which are floating, up and down, and simulated, and the input data can also be configured to come from the input register or other peripheral registers. The Reset register makes it easy to configure each one individually, which is useful in many cases.
After a description of the Gpio mode, here is a summary of its mode of operation, it has a total of eight combinations, that is, there are eight kinds of configurable mode of operation, namely:
- Enter floating space
- Input pull-up
- Input drop-down
- Simulation
- Open-drain output with pull-up or pull-down
- Push-pull output with pull-up or pull-down
- Multiplexing function push-pull with pull-up or pull-down
- Multiplexing function with pull-up or pull-down open-drain
STM32 Series MCU IO port mode setting