4. I/O operating modes
STM32WL30xx/31xx/33xx devices propose up to 32 programmable I/Os (depending on the package).
Each I/O can be programmed in several modes:
- • input mode
- • output mode
- • Alternate function
- • Analog mode (when available)
STM32WL30xx/31xx/33xx devices support seven alternate modes called AFx (x = 0 to 6). The configuration of each I/O for those alternate modes is detailed in Table 8, Table 9 and Table 10. Some additional functions are also available see Table 11.
Note: The I/Os features presented in Table 8 and Table 9 are valid only when the associated I/O is programmed as alternate function.
Refer to Section 7: General-purpose I/Os (GPIO) for more details on all configurations.
The number of I/Os available in the STM32WL30xx/31xx/33xx device depends on the package:
- – 32 I/Os in QFN48
- – 17 I/Os in QFN32
Type acronyms correspond to:
- – I: Input
- – O: Output
- – I/O: Input Output
- – OD: Open Drain
Table 8. GPIO alternate options AF0 - AF3(1)
| Pin name | AF0 mode | AF1 mode | AF2 mode | AF3 mode | ||||
|---|---|---|---|---|---|---|---|---|
| Type | Signal | Type | Signal | Type | Signal | Type | Signal | |
| Port A | ||||||||
| PA0(2) | I/OD | I2C1_SCL | I | USART_CTS | - | - | - | - |
| PA1(2) | I/OD | I2C1_SDA | I/O | USART_TX | I/O | TIM16_BRK | - | - |
| PA2 | I/O | SWDIO | I/O | USART_CK | I/O | TIM16_CH1 | O | I2S3_MCK |
| PA3 | I | SWCLK | O | USART_RTS_DE | O | TIM16_CH1N | I/O | SPI3_SCK/ I2S3_CK |
| PA4 | O | LCO | I/O | LPUART_TX | O | COMP1_OUT | - | - |
| PA5 | O | MCO | I/O | LPUART_RX | - | - | - | - |
| PA6 | I/OD | I2C2_SCL | I | USART_CTS | - | - | - | - |
| PA7 | I/OD | I2C2_SDA | O | LPUART_RTS_DE | - | - | - | - |
| Pin name | AF0 mode | AF1 mode | AF2 mode | AF3 mode | ||||
|---|---|---|---|---|---|---|---|---|
| Type | Signal | Type | Signal | Type | Signal | Type | Signal | |
| PA8 | I/O | RTC_OUT /RTC_TAMP1 /RTC_TS | I/O | USART_RX | O | RX_SEQUENCE | I/O | SPI3_MISO |
| PA9 | - | - | I/O | USART_TX | O | RTC_OUT | I/O | SPI3_NSS/ I2S3_WS |
| PA10 | - | - | I | LPUART_CTS | O | TX_SEQUENCE | O | I2S3_MCK |
| PA11 | O | MCO | - | - | O | RX_SEQUENCE | I/O | SPI3_MOSI/ I2S3_SD |
| PA12 | I/O | I2C1_SMBA | I/O | SWDIO | - | - | I/O | SPI1_NSS |
| PA13 | I/OD | I2C2_SCL | I | SWCLK | - | - | I/O | SPI1_SCK |
| PA14 | I/OD | I2C2_SDA | - | - | - | - | I/O | SPI1_MISO |
| PA15 | I/O | I2C2_SMBA | I/O | USART_RX | - | - | I/O | SPI1_MOSI |
| Port B | ||||||||
| PB0(3) | I/O | USART_RX | O | LPUART_RTS_DE | I/O | TIM16_CH1 | I/O | SPI1_NSS |
| PB1 | I/O | USART_CK | I/O | SWDIO | O | TIM16_CH1N | I/O | SPI1_SCK |
| PB2 | O | USART_RTS_DE | I | SWCLK | I/O | TIM16_BRK | I/O | SPI1_MISO |
| PB3 | I | USART_CTS | I/O | LPUART_TX | - | - | I/O | SPI1_MOSI |
| PB4 | - | - | I/O | LPUART_TX | - | - | I/O | SPI3_MISO |
| PB5 | - | - | I/O | LPUART_RX | - | - | I/O | SPI3_NSS/ I2S3_WS |
| PB6(2) | I/OD | I2C1_SCL | I/O | LPUART_TX | O | COMP1_OUT | I/O | SPI3_SCK/ I2S3_CK |
| PB7(2) | I/OD | I2C1_SDA | I/O | LPUART_RX | O | RF_ACTIVITY | I/O | SPI3_MOSI/ I2S3_SD |
| PB8 | I/O | USART_CK | I/O | LPUART_RX | - | - | I/O | SPI1_MISO |
| PB9 | I/O | USART_TX | I | LPUART_CTS | - | - | I/O | SPI1_MOSI |
| PB10 | I/OD | I2C1_SDA | - | - | - | - | I/O | SPI1_NSS |
| PB11 | I/OD | I2C1_SCL | O | USART_RTS_DE | O | LC_ACTIVITY | I/O | SPI1_SCK |
| PB12(3) | O | USART_RTS_DE | I | LPUART_CTS | O | LCO | - | - |
| PB13(4) | I/O | I2C2_SMBA | - | - | - | - | - | - |
| PB14 | I/O | I2C1_SMBA | I/O | USART_RX | O | TX_SEQUENCE | O | MCO |
| PB15 | - | - | I/O | USART_TX | O | COMP1_OUT | - | - |
- 1. The green cells correspond to I/Os available on the VFQFN32 package
The blue cells correspond to unbonded pads on the VFQFN32 package
STM32WL30xx devices are only available in the VFQFPN32 package. - 2. This I/O is able to be configured in open-drain.
- 3. This I/O is shared with OSC32_OUT (low speed clock oscillator pin).
- 4. This I/O is shared with OSC32_IN (low speed clock oscillator pin).
- Note: 1 Comparator, DAC, I2C2, LCSC, LCD, LPAWUR are available only on STM32WL33xx devices.
- 2 ADC, temperature sensor, I2C1, SPI1, I2S are available only on STM32WL31xx/33xx devices.
| Pin name | AF4 mode | AF5 mode | AF6 mode | |||
|---|---|---|---|---|---|---|
| Type | Signal | Type | Signal | Type | Signal | |
| Port A | ||||||
| PA0(2) | I/O | TIM2_CH3 | - | - | O | LCD_SEG12 / LCD_COM4 |
| PA1(2) | I/O | TIM2_CH4 | - | - | O | LCD_SEG0 |
| PA2 | I/O | TIM2_CH1 | I/O | SWDIO | O | LCD_SEG1 |
| PA3 | I/O | TIM2_CH2 | I | SWCLK | O | LCD_SEG2 |
| PA4 | I/O | TIM2_CH1 | - | - | - | - |
| PA5 | I/O | TIM2_CH2 | - | - | O | LCD_SEG9 |
| PA6 | I/O | TIM2_CH1 | - | - | - | - |
| PA7 | I/O | TIM2_CH2 | - | - | - | - |
| PA8 | I/O | TIM2_CH3 | - | - | O | LCD_COM0 |
| PA9 | I/O | TIM2_CH4 | - | - | O | LCD_SEG3 |
| PA10 | I | SUBG_TX_DATA | - | - | O | LCD_SEG4 |
| PA11 | O | SUBG_TX_CLOCK | - | - | O | LCD_SEG5 |
| PA12 | I/O | TIM2_CH1 | - | - | - | - |
| PA13 | I | TIM2_ETR | - | - | O | LCD_SEG10 |
| PA14 | - | - | - | - | O | LCD_SEG11 |
| PA15 | - | - | - | - | - | - |
| Pin name | AF4 mode | AF5 mode | AF6 mode | |||
|---|---|---|---|---|---|---|
| Type | Signal | Type | Signal | Type | Signal | |
| Port B | ||||||
| PB0 | O | ANTENNA_SWITCH | - | - | O | LCD_COM1 |
| PB1 | O | SUBG_RX_DATA | - | - | O | LCD_SEG6 |
| PB2 | O | SUBG_RX_CLOCK | - | - | O | LCD_SEG7 |
| PB3 | I/O | TIM2_CH4 | - | - | O | LCD_SEG8 |
| PB4 | - | - | - | - | O | LCD_SEG13 / LCD_COM5 |
| PB5 | - | - | - | - | O | LCD_SEG14 / LCD_COM6 |
| PB6 (2) | I/O | TIM2_CH3 | - | - | O | LCD_SEG15 / LCD_COM7 |
| PB7 (2) | I | TIM2_ETR | - | - | O | LCD_COM2 |
| PB8 | I/O | TIM2_CH4 | - | - | - | - |
| PB9 | - | - | - | - | - | - |
| PB10 | I/O | TIM2_CH2 | - | - | - | - |
| PB11 | I/O | TIM2_CH1 | - | - | - | - |
| PB12(3) | I/O | TIM2_CH3 | - | - | - | - |
| PB13(4) | I/O | TIM2_CH4 | - | - | - | - |
| PB14 | I | TIM2_ETR | - | - | O | LCD_COM3 |
| PB15 | - | - | - | - | I/O | LCD_VLCD |
- 1. The green cells correspond to I/Os available on the VFQFN32 package
The blue cells correspond to not bonded pads on the VFQFN32 package
STM32WL30xx devices are only available in the VFQFPN32 package. - 2. This I/O is able to be configured in open-drain.
- 3. This I/O is shared with OSC32_OUT (low speed clock oscillator pin).
- 4. This I/O is shared with OSC32_IN (low speed clock oscillator pin).
Note:
- 1. Comparator, DAC, I2C2, LCSC, LCD, LPAWUR are available only on STM32WL33xx devices.
- 2. ADC, temperature sensor, I2C1, SPI1, I2S are available only on STM32WL31xx/33xx devices.
Concerning the ADC block present in STM32WL31xx/33xx devices.
- • The 8 ADC channels are available on PA2, PA3, PB0, PB1, PB2, PB3, PB4, PB5.
Concerning the comparator present in the STM32WL33xx device:
- • The Comp minus channel is available on PA13, PB0, PB3
- • The Comp plus channel is available on PA14, PB1, PB2
Note: The ADC/Comp features on those pins are available if the associated pin is configured in analog mode (see Section 7: General-purpose I/Os (GPIO) for more details).
Table 10 shows the mapping associated to analog configuration (for pins able to support analog mode).
Table 10. I/O Analog feature mapping(1) (2)
| Pin name | Analog feature | Parallel Analog feature | Pin name | Analog feature | Parallel Analog feature |
|---|---|---|---|---|---|
| Port A | Port B | ||||
| PA0 | N/A | - | PB0 | ADC_VINM1 | COMP1_INN1 |
| PA1 | N/A | - | PB1 | ADC_VINP1 | COMP1_INP/LCSCOUT1 |
| PA2 | ADC_VINM2 | - | PB2 | ADC_VINM0 | COMP1_INP/LCSCOUT3 |
| PA3 | ADC_VINP2 | - | PB3 | ADC_VINP0 | COMP1_INN2 |
| PA4 | N/A | - | PB4 | ADC_VINM3 | VCMBUFF |
| PA5 | N/A | - | PB5 | ADC_VINP3 | N/A |
| PA6 | N/A | - | PB6 | N/A | N/A |
| PA7 | N/A | - | PB7 | N/A | N/A |
| PA8 | N/A | - | PB8 | N/A | N/A |
| PA9 | N/A | - | PB9 | N/A | N/A |
| PA10 | N/A | - | PB10 | N/A | N/A |
| PA11 | N/A | - | PB11 | N/A | |
| PA12 | N/A | - | PB12 | - | SXTALO(3) |
| PA13 | COMP1_INN0 | DACOUT_GPIO | PB13 | - | SXTALI(3) |
| PA14 | COMP1_INP | LCSCOUT2 | PB14 | - | PVD VIN(4) |
| PA15 | N/A | - | PB15 | - | N/A |
- 1. N/A means Not Applicable as the associated I/O does not support analog option.
- 2. The green cells correspond to I/Os available on VFQFN32 package
The blue cells correspond to not bonded pads on VFQFN32 package
STM32WL30xx devices are only available in the VFQFPN32 package. - 3. The parallel analog feature is obtained by setting the RCC_CR.LSEON bit in the RCC registers. Then the PB12 and PB13 are forced by hardware to manage the LSE through SXTALO/SXTALI whatever the selected mode in the associated GPIO_MODERx register, but if APC is set is necessary to disable PUB12/PUB13/PDB12/PDB13 in PWR registers.
- 4. The selection between ATB1 and PVD is done through a register in the SYSCFG block (see 8.2.11: I/O analog switch control register (GPIO_SWA_CTRL) for details).
| Pin name | Function | Pin name | Function |
|---|---|---|---|
| Port A | Port B | ||
| PA0 | - | PB0 | - |
| PA1 | - | PB1 | LCSCOUT1 |
| PA2 | - | PB2 | LCSCOUT3 |
| PA3 | - | PB3 | - |
| PA4 | - | PB4 | - |
| PA5 | - | PB5 | - |
| PA6 | - | PB6 | - |
| PA7 | - | PB7 | - |
| PA8 | - | PB8 | - |
| PA9 | - | PB9 | - |
| PA10 | LCO | PB10 | - |
| PA11 | - | PB11 | - |
| PA12 | - | PB12 | SXTALO(2) |
| PA13 | - | PB13 | SXTALI(2) |
| PA14 | LCSCOUT2 | PB14 | - |
| PA15 | - | PB15 | - |
- 1. The green cells correspond to I/Os available on VFQFN32 package
The blue cells correspond to not bonded pads on VFQFN32 package
STM32WL30xx devices are only available in the VFQFPN32 package. - 2. The parallel analog feature is obtained by setting the RCC_CR.LSEON bit in the RCC registers. Then the PB12 and PB13 are forced by hardware to manage the LSE through SXTALO/SXTALI whatever the selected mode in the associated GPIO_MODERx register, but if APC is set is necessary to disable PUB12/PUB13/PDB12/PDB13 in PWR registers.