Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
stm32:peripherals:gpio_alternate [2016/11/08 08:06] – feur | stm32:peripherals:gpio_alternate [2022/12/28 08:20] (current) – ruan | ||
---|---|---|---|
Line 13: | Line 13: | ||
Depending on the alternate function you have to configure the pins as: | Depending on the alternate function you have to configure the pins as: | ||
- | * [[gpio_input|digital input]], | + | * [[gpio_input# |
- | * [[gpio_output|digital output]] or | + | * [[gpio_output# |
- | * in [[gpio_analog|analgo | + | * [[gpio_analog# |
- | + | \\ | |
- | ==== Enable Peripheral ==== | + | |
- | + | ||
- | Make sure the peripheral is enabled: | + | |
- | * Enable GPIOx in '' | + | |
- | + | ||
- | ==== Setup input mode ==== | + | |
- | + | ||
- | Configure the MODE and PUPDR register, for every pin that should act as digital input: | + | |
- | * Write '' | + | |
- | * Configure pull-up / -down in '' | + | |
===== Configuration Registers ===== | ===== Configuration Registers ===== | ||
- | ==== MODER ==== | + | ==== GPIOx_MODER - Mode register |
- | + | ||
- | Mode register | + | |
\\ {{gpio_reg_common.svg}} \\ \\ | \\ {{gpio_reg_common.svg}} \\ \\ | ||
|< 100% 5em 5em >| | |< 100% 5em 5em >| | ||
- | |Pin x|11|Alternate function mode| | + | |Pin x|10|Alternate function mode| |
- | ==== AFRL/H ==== | + | ==== GPIOx_AFRL/H - Alternate function register (low / high) ==== |
- | + | ||
- | Alternate function register (low / high) | + | |
\\ {{gpio_reg_afrl.svg}} \\ \\ | \\ {{gpio_reg_afrl.svg}} \\ \\ | ||
Line 52: | Line 37: | ||
|::: | |::: | ||
|::: | |::: | ||
- | |::: | + | |::: |
- | |::: | + | |::: |
- | |::: | + | |::: |
- | |::: | + | |::: |
- | |::: | + | |::: |
|::: | |::: | ||
|::: | |::: | ||
- | |::: | + | |::: |
|::: | |::: | ||
- | |::: | + | |::: |
|::: | |::: | ||
- | ==== PUPDR ==== | + | ==== GPIOx_PUPDR - GPIO port pull-up / pull-down register |
- | + | ||
- | Push-up / pull-down register | + | |
\\ {{gpio_reg_common.svg}} \\ \\ | \\ {{gpio_reg_common.svg}} \\ \\ | ||
Line 76: | Line 59: | ||
|::: | |::: | ||
- | ==== OTYPER | + | ==== GPIOx_OTYPER - Port output type register |
- | + | ||
- | Output type register | + | |
\\ {{gpio_reg_otyper.svg}} \\ \\ | \\ {{gpio_reg_otyper.svg}} \\ \\ | ||
Line 86: | Line 67: | ||
|::: | |::: | ||
- | ==== OSPEEDR | + | ==== GPIOx_OSPEEDR - Port output speed register |
- | + | ||
- | Output speed register | + | |
\\ {{gpio_reg_common.svg}} \\ \\ | \\ {{gpio_reg_common.svg}} \\ \\ | ||
Line 98: | Line 77: | ||
|::: | |::: | ||
- | ===== Data Registers ===== | ||
- | |||
- | There are no data registers available in alternate function mode. | ||
- | \\ \\ | ||
- | |||
- | ===== Legend ===== | ||
- | |||
- | \\ {{legende.svg}} \\ \\ |