Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
stm32:peripherals:gpio_alternate [2016/11/08 08:06] feurstm32: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#programming_instructions|digital input]], 
-  * [[gpio_output|digital output]] or +  * [[gpio_output#programming_instructions|digital output]] or 
-  * in [[gpio_analog|analgo input]]. +  * [[gpio_analog#programming_instructions|analog input]]. 
- +\\
-==== Enable Peripheral ==== +
- +
-Make sure the peripheral is enabled: +
-  * Enable GPIOx in ''RCC->AHBENR[0]''+
- +
-==== Setup input mode ==== +
- +
-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''+
 ===== 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:
 |:::|0011|AF3: Timer 8..11| |:::|0011|AF3: Timer 8..11|
 |:::|0100|AF4: I²C 1..3| |:::|0100|AF4: I²C 1..3|
-|:::|0101|AF5: SPI 1,2,4..6| +|:::|0101|AF5: SPI 1..6| 
-|:::|0110|AF6: SPI 3, SAI 1| +|:::|0110|AF6: SPI 2/3, SAI 1| 
-|:::|0111|AF7: USART 1..3, I²S 3 Ext+|:::|0111|AF7: SPI 3, USART 1..3| 
-|:::|1000|AF8: UART 4..8| +|:::|1000|AF8: USART 6, UART 4/5/7/8| 
-|:::|1001|AF9: CAN 1..2, Timer 12..14|+|:::|1001|AF9: CAN 1/2, Timer 12..14, LCD|
 |:::|1010|AF10: USB OTG HS/FS| |:::|1010|AF10: USB OTG HS/FS|
 |:::|1011|AF11: Ethernet| |:::|1011|AF11: Ethernet|
-|:::|1100|AF12: FMC, USB OTG HS/FS, SDIO|+|:::|1100|AF12: FMC, SDIO, USB OTG FS|
 |:::|1101|AF13: DCMI| |:::|1101|AF13: DCMI|
-|:::|1110|AF14: LTDC|+|:::|1110|AF14: LCD|
 |:::|1111|AF15: Event Out| |:::|1111|AF15: Event Out|
  
-==== 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:
 |:::|11|Reserved| |:::|11|Reserved|
  
-==== OTYPER ==== +==== GPIOx_OTYPER - Port output type register ====
- +
-Output type register+
  
 \\ {{gpio_reg_otyper.svg}} \\ \\ \\ {{gpio_reg_otyper.svg}} \\ \\
Line 86: Line 67:
 |:::|1|Output type: open-drain| |:::|1|Output type: open-drain|
  
-==== OSPEEDR ==== +==== GPIOx_OSPEEDR - Port output speed register ====
- +
-Output speed register +
  
 \\ {{gpio_reg_common.svg}} \\ \\ \\ {{gpio_reg_common.svg}} \\ \\
Line 98: Line 77:
 |:::|11|Speed: 100 MHz| |:::|11|Speed: 100 MHz|
  
-===== Data Registers ===== 
- 
-There are no data registers available in alternate function mode. 
-\\ \\ 
- 
-===== Legend ===== 
- 
-\\ {{legende.svg}} \\ \\ 
  • stm32/peripherals/gpio_alternate.1478592411.txt.gz
  • Last modified: 2016/11/08 08:06
  • by feur