This is an old revision of the document!
General Purpose Output
- The output buffer is enabled (open drain or push-pull).
- 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.
- Output data register holds last written value.
Programming Instruction
Enable Peripheral
Make sure the peripheral is enabled:
- Enable GPIOx in
RCC→AHBENR[0].
Setup output mode
Configure the MODE and PUPDR as well as the output type and speed register,
for every pin that should act as digital output:
- Write
0x01to the corresponding fields inGPIOx→MODE. - Configure pull-up / -down in
GPIOx→PUPDR. - Configure output type in
GPIOx→OTYPER.
(in conjunction withGPIOx→PUPDR) - Configure output speed in
GPIOx→OSPEEDR.
Configuration Registers
MODER
PUPDR
Push-up / pull-down register
| Pin x | 00 | No pull-up, pull-down (reset state) |
| 01 | Pull-up | |
| 10 | Pull-down | |
| 11 | Reserved |
OTYPER
OSPEEDR
Output speed register
| Pin x | 00 | Speed: 2 MHz (reset state) |
| 01 | Speed: 10 MHz | |
| 10 | Speed: 50 MHz | |
| 11 | Speed: 100 MHz |