General Purpose Input

  • The output buffer is disabled.
  • The Schmitt trigger input is active.
  • The pull-up and -down resistors are active, according to PUPDR.
  • Input data is sampled every AHB clock.
  • Input data register holds I/O state.




Make sure the peripheral is enabled:

  • Enable GPIOx in RCC→AHBENR[0].

Configure the MODE and PUPDR register, for every pin that should act as digital input:

  • Write 0x00 to the corresponding fields in GPIOx→MODE.
  • Configure pull-up / -down in GPIOx→PUPDR.





Pin x00Input mode (reset state)




Pin x00No pull-up, pull-down (reset state)
01Pull-up
10Pull-down




* Register is read only

  • stm32/peripherals/gpio_input.txt
  • Last modified: 2022/12/28 08:15
  • by ruan