7. General-purpose and alternate-function I/Os (GPIOs and AFIOs)

Low-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 16 and 32 Kbytes.

Medium-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 64 and 128 Kbytes.

High-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 256 and 512 Kbytes.

This section applies to the whole STM32F100xx family, unless otherwise specified.

7.1 GPIO functional description

Each of the general-purpose I/O ports has two 32-bit configuration registers (GPIOx_CRL, GPIOx_CRH), two 32-bit data registers (GPIOx_IDR, GPIOx_ODR), a 32-bit set/reset register (GPIOx_BSRR), a 16-bit reset register (GPIOx_BRR) and a 32-bit locking register (GPIOx_LCKR).

Subject to the specific hardware characteristics of each I/O port listed in the datasheet , each port bit of the General Purpose IO (GPIO) Ports, can be individually configured by software in several modes:

Each I/O port bit is freely programmable, however the I/O port registers have to be accessed as 32-bit words (half-word or byte accesses are not allowed). The purpose of the GPIOx_BSRR and GPIOx_BRR registers is to allow atomic read/modify accesses to any of the GPIO registers. This way, there is no risk that an IRQ occurs between the read and the modify access.

Figure 11 shows the basic structure of an I/O Port bit.

Figure 11. Basic structure of a standard I/O port bit

Schematic diagram of a standard I/O port bit showing internal components like input/output drivers, registers, and protection diodes connected to an I/O pin.

This schematic diagram illustrates the internal architecture of a standard I/O port bit. On the left, external signals enter the chip: 'Analog Input' and 'Alternate Function Input' connect to an 'Input driver' containing a 'TTL Schmitt trigger'. The 'Input driver' is connected to an 'Input data register', which is read by 'Read' signals from on-chip peripherals. Below this, 'Bit set/reset registers' are used to 'Write' to the 'Output data register'. The 'Output data register' is controlled by 'Read/write' signals from on-chip peripherals and provides 'Alternate Function Output'. The 'Output data register' connects to an 'Output control' block, which drives a pair of 'P-MOS' and 'N-MOS' transistors configured as a 'Push-pull, open-drain or disabled' output driver. The 'Output driver' is connected to an 'I/O pin' through 'Protection diode' structures. Pull-up and pull-down resistors are connected between the internal signal lines and \( V_{DD} \) and \( V_{SS} \) respectively, with 'on/off' switches. The identifier 'ai14781' is located in the bottom right corner.

Schematic diagram of a standard I/O port bit showing internal components like input/output drivers, registers, and protection diodes connected to an I/O pin.

Figure 12. Basic structure of a 5-Volt tolerant I/O port bit

Schematic diagram of a 5-Volt tolerant I/O port bit, similar to Figure 11 but with a different protection diode structure involving V_DD_FT.

This schematic diagram shows the internal architecture of a 5-Volt tolerant I/O port bit. It shares the same input and output driver stages as Figure 11, including 'Analog Input', 'Alternate Function Input', 'Input driver' with 'TTL Schmitt trigger', 'Input data register', 'Bit set/reset registers', 'Output data register', 'Output control', and 'P-MOS/N-MOS' drivers. The key difference is in the protection circuitry at the 'I/O pin'. Instead of a standard diode to \( V_{DD} \) , it features a protection structure involving \( V_{DD\_FT}^{(1)} \) and a 'Protection diode' to \( V_{SS} \) . Pull-up and pull-down resistors to \( V_{DD} \) and \( V_{SS} \) are also present. The identifier 'ai14782' is located in the bottom right corner.

Schematic diagram of a 5-Volt tolerant I/O port bit, similar to Figure 11 but with a different protection diode structure involving V_DD_FT.

1. \( V_{DD\_FT} \) is a potential specific to 5-Volt tolerant I/Os, and different from \( V_{DD} \) .

Table 16. Port bit configuration table

Configuration modeCNF1CNF0MODE1MODE0PxODR register
General purpose outputPush-pull00010 or 1
Open-drain10 or 1
Alternate Function outputPush-pull1011see Table 17Don't care
Open-drain1Don't care
InputAnalog0000Don't care
Input floating1Don't care
Input pull-down100
Input pull-up1

Table 17. Output MODE bits

MODE[1:0]Meaning
00Reserved
01Maximum output speed 10 MHz
10Maximum output speed 2 MHz
11Maximum output speed 50 MHz

7.1.1 General-purpose I/O (GPIO)

During and just after reset, the alternate functions are not active and the I/O ports are configured in Input Floating mode (CNFx[1:0]=01b, MODEx[1:0]=00b).

The JTAG pins are in input PU/PD after reset:

PA15: JTDI in PU

PA14: JTCK in PD

PA13: JTMS in PU

PB4: NJTRST in PU

When configured as output, the value written to the Output Data register (GPIOx_ODR) is output on the I/O pin. It is possible to use the output driver in Push-Pull mode or Open-Drain mode (only the N-MOS is activated when outputting 0).

The Input Data register (GPIOx_IDR) captures the data present on the I/O pin at every APB2 clock cycle.

All GPIO pins have an internal weak pull-up and weak pull-down that can be activated or not when configured as input.

7.1.2 Atomic bit set or reset

There is no need for the software to disable interrupts when programming the GPIOx_ODR at bit level: it is possible to modify only one or several bits in a single atomic APB2 write access. This is achieved by programming to '1' the Bit Set/Reset register (GPIOx_BSRR, or

for reset only GPIOx_BRR) to select the bits to modify. The unselected bits will not be modified.

7.1.3 External interrupt/wakeup lines

All ports have external interrupt capability. To use external interrupt lines, the port must be configured in input mode. For more information on external interrupts, refer to Section 8.2: External interrupt/event controller (EXTI) and Section 8.2.3: Wakeup event management .

7.1.4 Alternate functions (AF)

It is necessary to program the Port Bit Configuration register before using a default alternate function.

Note: It is also possible to emulate the AF input pin by software by programming the GPIO controller. In this case, the port should be configured in Alternate Function Output mode. And obviously, the corresponding port should not be driven externally as it will be driven by the software using the GPIO controller.

If a port bit is configured as Alternate Function Output, this disconnects the output register and connects the pin to the output signal of an on-chip peripheral.

If software configures a GPIO pin as Alternate Function Output, but peripheral is not activated, its output is not specified.

7.1.5 Software remapping of I/O alternate functions

To optimize the number of peripheral I/O functions for different device packages, it is possible to remap some alternate functions to some other pins. This is achieved by software, by programming the corresponding registers (refer to AFIO registers ). In that case, the alternate functions are no longer mapped to their original assignations.

7.1.6 GPIO locking mechanism

The locking mechanism allows the IO configuration to be frozen. When the LOCK sequence has been applied on a port bit, it is no longer possible to modify the value of the port bit until the next reset.

7.1.7 Input configuration

When the I/O Port is programmed as Input:

Figure 13 shows the Input Configuration of the I/O Port bit.

Figure 13: Input floating/pull up/pull down configurations. The diagram shows the internal logic of a GPIO bit. On the left, 'Read', 'Write', and 'Read/write' signals interface with 'Bit set/reset registers', 'Output data register', and 'Input data register'. The input path goes from the 'I/O pin' through protection diodes (connected to VDD or VDD_FT and VSS), then through a TTL Schmitt trigger (with an 'on' control signal). Weak pull-up and pull-down resistors with 'on/off' switches are connected to VDD and VSS respectively. The output path includes an 'output driver' and an 'input driver' block. The whole circuit is labeled with ai14783.

Figure 13. Input floating/pull up/pull down configurations

Figure 13: Input floating/pull up/pull down configurations. The diagram shows the internal logic of a GPIO bit. On the left, 'Read', 'Write', and 'Read/write' signals interface with 'Bit set/reset registers', 'Output data register', and 'Input data register'. The input path goes from the 'I/O pin' through protection diodes (connected to VDD or VDD_FT and VSS), then through a TTL Schmitt trigger (with an 'on' control signal). Weak pull-up and pull-down resistors with 'on/off' switches are connected to VDD and VSS respectively. The output path includes an 'output driver' and an 'input driver' block. The whole circuit is labeled with ai14783.

1. \( V_{DD\_FT} \) is a potential specific to 5-Volt tolerant I/Os, and different from \( V_{DD} \) .

7.1.8 Output configuration

When the I/O Port is programmed as Output:

Figure 14 shows the Output configuration of the I/O Port bit.

Figure 14. Output configuration

Figure 14. Output configuration diagram showing the internal circuitry of an I/O pin. The diagram illustrates the path from the I/O pin through protection diodes to VDD or VDD_FT and VSS. An 'Input driver' block contains a 'TTL Schmitt trigger' with an 'on' switch, feeding into the 'Input data register' which can be 'Read'. An 'Output driver' block contains 'Output control' logic driving a 'P-MOS' (connected to VDD) and an 'N-MOS' (connected to VSS) transistor pair for 'Push-pull or Open-drain' operation. The 'Output control' is fed by the 'Output data register', which can be written to via 'Bit set/reset registers' or directly via 'Read/write' access. Diagram label: ai14784.
Figure 14. Output configuration diagram showing the internal circuitry of an I/O pin. The diagram illustrates the path from the I/O pin through protection diodes to VDD or VDD_FT and VSS. An 'Input driver' block contains a 'TTL Schmitt trigger' with an 'on' switch, feeding into the 'Input data register' which can be 'Read'. An 'Output driver' block contains 'Output control' logic driving a 'P-MOS' (connected to VDD) and an 'N-MOS' (connected to VSS) transistor pair for 'Push-pull or Open-drain' operation. The 'Output control' is fed by the 'Output data register', which can be written to via 'Bit set/reset registers' or directly via 'Read/write' access. Diagram label: ai14784.

1. \( V_{DD\_FT} \) is a potential specific to 5-Volt tolerant I/Os, and different from \( V_{DD} \) .

7.1.9 Alternate function configuration

When the I/O Port is programmed as Alternate Function:

Figure 15 shows the Alternate Function Configuration of the I/O Port bit. Also, refer to Section 7.4: AFIO registers for further information.

A set of Alternate Function I/O registers allows the user to remap some alternate functions to different pins. Refer to Section 7.3: Alternate function I/O and debug configuration (AFIO) .

Figure 15. Alternate function configuration

Figure 15. Alternate function configuration. This block diagram illustrates the internal architecture of an I/O pin when configured for alternate functions. On the left, an 'On-chip peripheral' is connected to an 'Alternate Function Input' and an 'Alternate Function Output'. The 'Alternate Function Input' path includes an 'Input data register' which is read by the peripheral. The 'Alternate Function Output' path includes an 'Output data register' which is written to and read from by the peripheral. The 'Input data register' is also connected to 'Bit set/reset registers'. The 'Output data register' is connected to an 'Output control' block. The 'Output control' block is connected to a 'TTL Schmitt trigger' (labeled 'on') and a 'push-pull or open-drain' driver consisting of a 'P-MOS' and an 'N-MOS' transistor. The 'P-MOS' is connected to VDD and the 'N-MOS' is connected to VSS. The 'I/O pin' is connected to the 'TTL Schmitt trigger' and the 'push-pull or open-drain' driver. The 'I/O pin' is also connected to two 'Protection diode' structures: one to VDD or VDD_FT(1) and another to VSS. The diagram is labeled ai14785.
Figure 15. Alternate function configuration. This block diagram illustrates the internal architecture of an I/O pin when configured for alternate functions. On the left, an 'On-chip peripheral' is connected to an 'Alternate Function Input' and an 'Alternate Function Output'. The 'Alternate Function Input' path includes an 'Input data register' which is read by the peripheral. The 'Alternate Function Output' path includes an 'Output data register' which is written to and read from by the peripheral. The 'Input data register' is also connected to 'Bit set/reset registers'. The 'Output data register' is connected to an 'Output control' block. The 'Output control' block is connected to a 'TTL Schmitt trigger' (labeled 'on') and a 'push-pull or open-drain' driver consisting of a 'P-MOS' and an 'N-MOS' transistor. The 'P-MOS' is connected to VDD and the 'N-MOS' is connected to VSS. The 'I/O pin' is connected to the 'TTL Schmitt trigger' and the 'push-pull or open-drain' driver. The 'I/O pin' is also connected to two 'Protection diode' structures: one to VDD or VDD_FT(1) and another to VSS. The diagram is labeled ai14785.

1. \( V_{DD\_FT} \) is a potential specific to 5-Volt tolerant I/Os, and different from \( V_{DD} \) .

7.1.10 Analog configuration

When the I/O Port is programmed as Analog configuration:

Figure 16 shows the high impedance-analog configuration of the I/O Port bit.

Figure 16. High impedance-analog configuration

Figure 16: High impedance-analog configuration diagram. The diagram shows the internal architecture of a GPIO pin in high impedance-analog mode. On the left, an 'Analog Input' is connected to an 'on-chip peripheral'. Below it, 'Read' and 'Write' signals are shown for 'Bit set/reset registers' and an 'Output data register'. A 'TTL Schmitt trigger' is shown with its input connected to the 'Input data register' and its output connected to the 'I/O pin'. The 'Input driver' is shown as a dashed box containing the 'Input data register' and the 'TTL Schmitt trigger'. The 'Output driver' is shown as a dashed box containing the 'Output data register' and a switch. The 'I/O pin' is connected to 'VDD or VDD_FT(1)' and 'VSS' through 'Protection diode' components. The diagram is labeled 'ai14786' in the bottom right corner.
Figure 16: High impedance-analog configuration diagram. The diagram shows the internal architecture of a GPIO pin in high impedance-analog mode. On the left, an 'Analog Input' is connected to an 'on-chip peripheral'. Below it, 'Read' and 'Write' signals are shown for 'Bit set/reset registers' and an 'Output data register'. A 'TTL Schmitt trigger' is shown with its input connected to the 'Input data register' and its output connected to the 'I/O pin'. The 'Input driver' is shown as a dashed box containing the 'Input data register' and the 'TTL Schmitt trigger'. The 'Output driver' is shown as a dashed box containing the 'Output data register' and a switch. The 'I/O pin' is connected to 'VDD or VDD_FT(1)' and 'VSS' through 'Protection diode' components. The diagram is labeled 'ai14786' in the bottom right corner.

7.1.11 GPIO configurations for device peripherals

Table 18 to Table 27 give the GPIO configurations of the device peripherals.

Table 18. Advanced timer TIM1

TIM1 pinoutConfigurationGPIO configuration
TIM1_CHxInput capture channel xInput floating
Output compare channel xAlternate function push-pull
TIM1_CHxNComplementary output channel xAlternate function push-pull
TIM1_BKINBreak inputInput floating
TIM1_ETRExternal trigger timer inputInput floating

Table 19. General-purpose timers TIM2/3/4/5

TIM2/3/4/5 pinoutConfigurationGPIO configuration
TIM2/3/4/5_CHxInput capture channel xInput floating
Output compare channel xAlternate function push-pull
TIM2/3/4/5_ETRExternal trigger timer inputInput floating

Table 20. General-purpose timers TIM15/16/17

TIM15/16/17 pinoutConfigurationGPIO configuration
TIM15/16/17_CHxInput capture channel xInput floating
Output compare channel xAlternate function push-pull
TIM15/16/17_CHxNComplementary output channel xAlternate function push-pull
Table 20. General-purpose timers TIM15/16/17
TIM15/16/17 pinoutConfigurationGPIO configuration
TIM15/16/17_BKINBreak inputInput floating
TIM15/16/17_ETRExternal trigger timer inputInput floating
Table 21. General-purpose timers TIM12/13/14
TIM12/13/14 pinoutConfigurationGPIO configuration
TIM12/13/14_CHxInput capture channel xInput floating
Output compare channel xAlternate function push-pull
Table 22. USARTs
USART pinoutConfigurationGPIO configuration
USARTx_TX (1)Full duplexAlternate function push-pull
Half duplex synchronous modeAlternate function push-pull
USARTx_RXFull duplexInput floating / Input pull-up
Half duplex synchronous modeNot used. Can be used as a general IO
USARTx_CKSynchronous modeAlternate function push-pull
USARTx_RTSHardware flow controlAlternate function push-pull
USARTx_CTSHardware flow controlInput floating/ Input pull-up

1. The USART_TX pin can also be configured as alternate function open drain.

Table 23. SPI
SPI pinoutConfigurationGPIO configuration
SPIx_SCKMasterAlternate function push-pull
SlaveInput floating
SPIx_MOSIFull duplex / masterAlternate function push-pull
Full duplex / slaveInput floating / Input pull-up
Simplex bidirectional data wire / masterAlternate function push-pull
Simplex bidirectional data wire/ slaveNot used. Can be used as a GPIO
SPIx_MISOFull duplex / masterInput floating / Input pull-up
Full duplex / slave (point to point)Alternate function push-pull
Full duplex / slave (multi-slave)Alternate function open drain
Simplex bidirectional data wire / masterNot used. Can be used as a GPIO
Simplex bidirectional data wire/ slave (point to point)Alternate function push-pull
Simplex bidirectional data wire/ slave (multi-slave)Alternate function open drain

Table 23. SPI (continued)

SPI pinoutConfigurationGPIO configuration
SPIx_NSSHardware master /slaveInput floating/ Input pull-up / Input pull-down
Hardware master/ NSS output enabledAlternate function push-pull
SoftwareNot used. Can be used as a GPIO

Table 24. CEC

CEC pinoutConfigurationGPIO configuration
CECCEC lineAlternate function open drain

Table 25. I2C

I2C pinoutConfigurationGPIO configuration
I2Cx_SCLI2C clockAlternate function open drain
I2Cx_SDAI2C Data I/OAlternate function open drain

The GPIO configuration of the ADC inputs should be analog.

Figure 17. ADC / DAC

ADC/DAC pinGPIO configuration
ADC/DACAnalog

Table 26. FSMC

FSMC pinoutGPIO configuration
FSMC_A[25:0]
FSMC_D[15:0]
Alternate function push-pull
FSMC_CKAlternate function push-pull
FSMC_NOE
FSMC_NWE
Alternate function push-pull
FSMC_NE[4:1]Alternate function push-pull
FSMC_NWAITInput floating/ Input pull-up
FSMC_NL
FSMC_NBL[1:0]
Alternate function push-pull

Table 27. Other I/Os

PinsAlternate functionGPIO configuration
TAMPER-RTC pinRTC outputForced by hardware when configuring the BKP_CR and BKP_RTCCR registers
Tamper event input
MCOClock outputAlternate function push-pull
EXTI input linesExternal input interruptsInput floating / input pull-up / input pull-down

7.2 GPIO registers

Refer to Section 1.1 on page 32 for a list of abbreviations used in register descriptions.

The peripheral registers have to be accessed by words (32-bit).

7.2.1 Port configuration register low (GPIOx_CRL) (x=A..G)

Address offset: 0x00

Reset value: 0x4444 4444

31302928272625242322212019181716
CNF7[1:0]MODE7[1:0]CNF6[1:0]MODE6[1:0]CNF5[1:0]MODE5[1:0]CNF4[1:0]MODE4[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
CNF3[1:0]MODE3[1:0]CNF2[1:0]MODE2[1:0]CNF1[1:0]MODE1[1:0]CNF0[1:0]MODE0[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:30, 27:26, 23:22, 19:18, 15:14, 11:10, 7:6, 3:2 CNFy[1:0] : Port x configuration bits (y= 0 .. 7)
These bits are written by software to configure the corresponding I/O port.
Refer to Table 16: Port bit configuration table .

In input mode (MODE[1:0]=00):

In output mode (MODE[1:0] > 00):

Bits 29:28, 25:24, 21:20, 17:16, 13:12, 9:8, 5:4, 1:0 MODEy[1:0] : Port x mode bits (y= 0 .. 7)
These bits are written by software to configure the corresponding I/O port.
Refer to Table 16: Port bit configuration table .

7.2.2 Port configuration register high (GPIOx_CRH) (x=A..G)

Address offset: 0x04

Reset value: 0x4444 4444

31302928272625242322212019181716
CNF15[1:0]MODE15[1:0]CNF14[1:0]MODE14[1:0]CNF13[1:0]MODE13[1:0]CNF12[1:0]MODE12[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
CNF11[1:0]MODE11[1:0]CNF10[1:0]MODE10[1:0]CNF9[1:0]MODE9[1:0]CNF8[1:0]MODE8[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:30, 27:26, CNFy[1:0] : Port x configuration bits (y= 8 .. 15)
23:22, 19:18, 15:14, 11:10, 7:6, 3:2 These bits are written by software to configure the corresponding I/O port.
Refer to Table 16: Port bit configuration table .

In input mode (MODE[1:0]=00):

In output mode (MODE[1:0] > 00):

Bits 29:28, 25:24, MODEy[1:0] : Port x mode bits (y= 8 .. 15)
21:20, 17:16, 13:12, 9:8, 5:4, 1:0 These bits are written by software to configure the corresponding I/O port.
Refer to Table 16: Port bit configuration table .

7.2.3 Port input data register (GPIOx_IDR) (x=A..G)

Address offset: 0x08h

Reset value: 0x0000 XXXX

31302928272625242322212019181716
Reserved
1514131211109876543210
IDR15IDR14IDR13IDR12IDR11IDR10IDR9IDR8IDR7IDR6IDR5IDR4IDR3IDR2IDR1IDR0
rrrrrrrrrrrrrrrr

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 IDRy : Port input data (y= 0 .. 15)

These bits are read only and can be accessed in Word mode only. They contain the input value of the corresponding I/O port.

7.2.4 Port output data register (GPIOx_ODR) (x=A..G)

Address offset: 0x0C

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ODR15ODR14ODR13ODR12ODR11ODR10ODR9ODR8ODR7ODR6ODR5ODR4ODR3ODR2ODR1ODR0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 ODRy : Port output data (y= 0 .. 15)

These bits can be read and written by software and can be accessed in Word mode only.

Note: For atomic bit set/reset, the ODR bits can be individually set and cleared by writing to the GPIOx_BSRR register (x = A .. E).

7.2.5 Port bit set/reset register (GPIOx_BSRR) (x=A..G)

Address offset: 0x10

Reset value: 0x0000 0000

31302928272625242322212019181716
BR15BR14BR13BR12BR11BR10BR9BR8BR7BR6BR5BR4BR3BR2BR1BR0
wwwwwwwwwwwwwwww
1514131211109876543210
BS15BS14BS13BS12BS11BS10BS9BS8BS7BS6BS5BS4BS3BS2BS1BS0
wwwwwwwwwwwwwwww

Bits 31:16 BRy : Port x Reset bit y (y= 0 .. 15)

These bits are write-only and can be accessed in Word mode only.

0: No action on the corresponding ODRx bit

1: Reset the corresponding ODRx bit

Note: If both BSx and BRx are set, BSx has priority.

Bits 15:0 BSy : Port x Set bit y (y= 0 .. 15)

These bits are write-only and can be accessed in Word mode only.

0: No action on the corresponding ODRx bit

1: Set the corresponding ODRx bit

7.2.6 Port bit reset register (GPIOx_BRR) (x=A..G)

Address offset: 0x14

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
BR15BR14BR13BR12BR11BR10BR9BR8BR7BR6BR5BR4BR3BR2BR1BR0
wwwwwwwwwwwwwwww

Bits 31:16 Reserved

Bits 15:0 BRy : Port x Reset bit y (y= 0 .. 15)

These bits are write-only and can be accessed in Word mode only.
0: No action on the corresponding ODRx bit
1: Reset the corresponding ODRx bit

7.2.7 Port configuration lock register (GPIOx_LCKR) (x=A..G)

This register is used to lock the configuration of the port bits when a correct write sequence is applied to bit 16 (LCKK). The value of bits [15:0] is used to lock the configuration of the GPIO. During the write sequence, the value of LCKR[15:0] must not change. When the LOCK sequence has been applied on a port bit it is no longer possible to modify the value of the port bit until the next reset.

Each lock bit freezes the corresponding 4 bits of the control register (CRL, CRH).

Address offset: 0x18

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedLCKK
rw
1514131211109876543210
LCK15LCK14LCK13LCK12LCK11LCK10LCK9LCK8LCK7LCK6LCK5LCK4LCK3LCK2LCK1LCK0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:17 Reserved

Bit 16 LCKK[16] : Lock key

This bit can be read anytime. It can only be modified using the Lock Key Writing Sequence.

0: Port configuration lock key not active

1: Port configuration lock key active. GPIOx_LCKR register is locked until the next reset.

LOCK key writing sequence:

Write 1

Write 0

Write 1

Read 0

Read 1 (this read is optional but confirms that the lock is active)

Note: During the LOCK Key Writing sequence, the value of LCK[15:0] must not change.

Any error in the lock sequence will abort the lock.

Bits 15:0 LCKy : Port x Lock bit y (y= 0 .. 15)

These bits are read write but can only be written when the LCKK bit is 0.

0: Port configuration not locked

1: Port configuration locked.

7.3 Alternate function I/O and debug configuration (AFIO)

To optimize the number of peripherals available for the 64-pin or the 100-pin or the 144-pin package, it is possible to remap some alternate functions to some other pins. This is achieved by software, by programming the AF remap and debug I/O configuration register (AFIO_MAPR) . In this case, the alternate functions are no longer mapped to their original assignments.

7.3.1 Using OSC32_IN/OSC32_OUT pins as GPIO ports PC14/PC15

The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general-purpose I/O PC14 and PC15, respectively, when the LSE oscillator is off. The LSE has priority over the GP IOs function.

Note: The PC14/PC15 GPIO functionality is lost when the 1.8 V domain is powered off (by entering standby mode) or when the backup domain is supplied by V BAT (V DD no more supplied). In this case the IOs are set in analog mode.

Refer to the note on IO usage restrictions in Section 4.1.2: Battery backup domain .

7.3.2 Using OSC_IN/OSC_OUT pins as GPIO ports PD0/PD1

The HSE oscillator pins OSC_IN/OSC_OUT can be used as general-purpose I/O PD0/PD1 by programming the PD01_REMAP bit in the AF remap and debug I/O configuration register (AFIO_MAPR) .

This remap is available only on 48- and 64-pin packages (PD0 and PD1 are available on 100-pin and 144-pin packages, no need for remapping).

Note: The external interrupt/event function is not remapped. PD0 and PD1 cannot be used for external interrupt/event generation on 48- and 64-pin packages.

7.3.3 JTAG/SWD alternate function remapping

The debug interface signals are mapped on the GPIO ports as shown in Table 28 .

Table 28. Debug interface signals

Alternate functionGPIO port
JTMS / SWDIOPA13
JTCK / SWCLKPA14
JTDIPA15
JTDO / TRACESWOPB3
NJTRSTPB4
TRACECKPE2
TRACED0PE3
TRACED1PE4
TRACED2PE5
TRACED3PE6

To optimize the number of free GPIOs during debugging, this mapping can be configured in different ways by programming the SWJ_CFG[1:0] bits in the AF remap and debug I/O configuration register (AFIO_MAPR) . Refer to Table 29 .

Table 29. Debug port mapping

SWJ_CFG [2:0]Available debug portsSWJ I/O pin assigned
PA13 / JTMS/ SWDIOPA14 / JTCK/S WCLKPA15 / JTDIPB3 / JTDO/ TRACE SWOPB4/ NJTRST
000Full SWJ (JTAG-DP + SW-DP) (Reset state)XXXXX
001Full SWJ (JTAG-DP + SW-DP) but without NJTRSTXXXxFree
010JTAG-DP Disabled and SW-DP EnabledXXFreeFree (1)Free
100JTAG-DP Disabled and SW-DP DisabledFreeFreeFreeFreeFree
OtherForbidden-----

1. Released only if not using asynchronous trace.

7.3.4 Timer alternate function remapping

Timer 4 channels 1 to 4 can be remapped from Port B to Port D. Other timer remapping possibilities are listed in Table 35 to Table 37 . Refer to AF remap and debug I/O configuration register (AFIO_MAPR) .

Table 30. TIM5 alternate function remapping (1)
Alternate functionTIM5CH4_IREMAP = 0TIM5CH4_IREMAP = 1
TIM5_CH4TIM5 Channel 4 is connected to PA3LSI internal clock is connected to TIM5_CH4 input for calibration purpose.
  1. 1. Remap available only for high-density value line devices.
Table 31. TIM12 remapping (1)
Alternate functionTIM12_REMAP = 0TIM12_REMAP = 1
TIM12_CH1PC4PB12
TIM12_CH2PC5PB13
  1. 1. Refer to the AF remap and debug I/O configuration register Section 7.4.7: AF remap and debug I/O configuration register (AFIO_MAPR2) . Remap available only for high-density value line devices.
Table 32. TIM13 remapping (1)
Alternate functionTIM13_REMAP = 0TIM13_REMAP = 1
TIM13_CH1PC8PB0
  1. 1. Refer to the AF remap and debug I/O configuration register Section 7.4.7: AF remap and debug I/O configuration register (AFIO_MAPR2) . Remap available only for high-density value line devices.
Table 33. TIM14 remapping (1)
Alternate functionTIM14_REMAP = 0TIM14_REMAP = 1
TIM14_CH1PC9PB1
  1. 1. Refer to the AF remap and debug I/O configuration register Section 7.4.7: AF remap and debug I/O configuration register (AFIO_MAPR2) . Remap available only for high-density value line devices.
Table 34. TIM4 alternate function remapping
Alternate functionTIM4_REMAP = 0TIM4_REMAP = 1 (1)
TIM4_CH1PB6PD12
TIM4_CH2PB7PD13
TIM4_CH3PB8PD14
TIM4_CH4PB9PD15
  1. 1. Remap available only for 100-pin and for 144-pin package.
Table 35. TIM3 alternate function remapping
Alternate functionTIM3_REMAP[1:0] = "00" (no remap)TIM3_REMAP[1:0] = "10" (partial remap)TIM3_REMAP[1:0] = "11" (full remap) (1)
TIM3_CH1PA6PB4PC6
TIM3_CH2PA7PB5PC7
TIM3_CH3PB0PC8
TIM3_CH4PB1PC9
  1. 1. Remap available only for 64-pin, 100-pin and 144-pin packages.
Table 36. TIM2 alternate function remapping
Alternate functionTIM2_REMAP [1:0] = "00" (no remap)TIM2_REMAP [1:0] = "01" (partial remap)TIM2_REMAP [1:0] = "10" (partial remap)TIM2_REMAP [1:0] = "11" (full remap)
TIM2_CH1_ETR (1)PA0PA15PA0PA15
TIM2_CH2PA1PB3PA1PB3
TIM2_CH3PA2PB10
TIM2_CH4PA3PB11
  1. 1. TIM_CH1 and TIM_ETR share the same pin but cannot be used at the same time (which is why we have this notation: TIM2_CH1_ETR).
Table 37. TIM1 alternate function remapping
Alternate functions mappingTIM1_REMAP[1:0] = "00" (no remap)TIM1_REMAP[1:0] = "01" (partial remap)TIM1_REMAP[1:0] = "11" (full remap) (1)
TIM1_ETRPA12PE7
TIM1_CH1PA8PE9
TIM1_CH2PA9PE11
TIM1_CH3PA10PE13
TIM1_CH4PA11PE14
TIM1_BKINPB12PA6PE15
TIM1_CH1NPB13PA7PE8
TIM1_CH2NPB14 (2)PB0PE10
TIM1_CH3NPB15 (2)PB1PE12
  1. 1. Remap available only for 100-pin and 144-pin packages.
Table 38. TIM1 DMA remapping (1)
DMA requestsTIM1_DMA_REMAP = 0TIM1_DMA_REMAP = 1
TIM1_CH1 DMA requestMapped on DMA1 Channel2Mapped on DMA1 Channel6
TIM1_CH2 DMA requestMapped on DMA1 Channel3Mapped on DMA1 Channel6
  1. 1. Refer to the AF remap and debug I/O configuration register Section 7.4.7: AF remap and debug I/O configuration register (AFIO_MAPR2) .
Table 39. TIM15 remapping (1)
Alternate functionTIM15_REMAP = 0TIM15_REMAP = 1
TIM15_CH1PA2PB14
TIM15_CH2PA3PB15
  1. 1. Refer to the AF remap and debug I/O configuration register Section 7.4.7: AF remap and debug I/O configuration register (AFIO_MAPR2) .
Table 40. TIM16 remapping (1)
Alternate functionTIM16_REMAP = 0TIM16_REMAP = 1
TIM16_CH1PB8PA6
  1. 1. Refer to the AF remap and debug I/O configuration register Section 7.4.7: AF remap and debug I/O configuration register (AFIO_MAPR2) .
Table 41. TIM17 remapping (1)
Alternate functionTIM17_REMAP = 0TIM17_REMAP = 1
TIM17_CH1PB9PA7
  1. 1. Refer to the AF remap and debug I/O configuration register Section 7.4.7: AF remap and debug I/O configuration register (AFIO_MAPR2) .

7.3.5 USART alternate function remapping

Refer to AF remap and debug I/O configuration register (AFIO_MAPR) .

Table 42. USART3 remapping

Alternate functionUSART3_REMAP[1:0] = "00" (no remap)USART3_REMAP[1:0] = "01" (partial remap) (1)USART3_REMAP[1:0] = "11" (full remap) (2)
USART3_TXPB10PC10PD8
USART3_RXPB11PC11PD9
USART3_CKPB12PC12PD10
USART3_CTSPB13PD11
USART3_RTSPB14PD12
  1. 1. Remap available only for 64-pin, 100-pin and 144-pin packages
  2. 2. Remap available only for 100-pin and 144-pin packages.

Table 43. USART2 remapping

Alternate functionsUSART2_REMAP = 0USART2_REMAP = 1 (1)
USART2_CTSPA0PD3
USART2_RTSPA1PD4
USART2_TXPA2PD5
USART2_RXPA3PD6
USART2_CKPA4PD7
  1. 1. Remap available only for 100-pin and 144-pin packages.

Table 44. USART1 remapping

Alternate functionUSART1_REMAP = 0USART1_REMAP = 1
USART1_TXPA9PB6
USART1_RXPA10PB7

7.3.6 I2C1 alternate function remapping

Refer to AF remap and debug I/O configuration register (AFIO_MAPR)

Table 45. I2C1 remapping

Alternate functionI2C1_REMAP = 0I2C1_REMAP = 1
I2C1_SCLPB6PB8
I2C1_SDAPB7PB9

7.3.7 SPI1 alternate function remapping

Refer to AF remap and debug I/O configuration register (AFIO_MAPR)

Table 46. SPI1 remapping

Alternate functionSPI1_REMAP = 0SPI1_REMAP = 1
SPI1_NSSPA4PA15
SPI1_SCKPA5PB3
SPI1_MISOPA6PB4
SPI1_MOSIPA7PB5

7.3.8 CEC remap

Refer to Section 7.4.7: AF remap and debug I/O configuration register (AFIO_MAPR2) .

Table 47. CEC remapping

Alternate functionCEC_REMAP = 0CEC_REMAP = 1
CECPB8PB10

7.4 AFIO registers

Refer to Section 1.1 on page 32 for a list of abbreviations used in register descriptions.

Note: To read/write the AFIO_EVCR, AFIO_MAPR, AFIO_MAPR2 and AFIO_EXTICRX registers, the AFIO clock should first be enabled. Refer to APB2 peripheral clock enable register (RCC_APB2ENR) .

The peripheral registers have to be accessed by words (32-bit).

7.4.1 Event control register (AFIO_EVCR)

Address offset: 0x00

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedEVOEPORT[2:0]PIN[3:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved

Bit 7 EVOE : Event output enable

Set and cleared by software. When set the EVENTOUT Cortex ® output is connected to the I/O selected by the PORT[2:0] and PIN[3:0] bits.

Bits 3:0 PIN[3:0] : Pin selection (x = A .. E)

Set and cleared by software. Select the pin used to output the Cortex ® EVENTOUT signal.

0000: Px0 selected

0001: Px1 selected

0010: Px2 selected

0011: Px3 selected

...

1111: Px15 selected

7.4.2 AF remap and debug I/O configuration register (AFIO_MAPR)

Address offset: 0x04

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedSWJ_CFG[2:0]ReservedTIM5CH4_IREMAP
wwwrw
1514131211109876543210
PD01_REMAPReservedTIM4_REMAPTIM3_REMAP [1:0]TIM2_REMAP [1:0]TIM1_REMAP [1:0]USART3_REMAP[1:0]USART2_REMAPUSART1_REMAPI2C1_REMAPSPI1_REMAP
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:27 Reserved

Bits 26:24 SWJ_CFG[2:0] : Serial wire JTAG configuration

These bits are write-only (when read, the value is undefined). They are used to configure the SWJ and trace alternate function I/Os. The SWJ (Serial Wire JTAG) supports JTAG or SWD access to the Cortex® debug port. The default state after reset is SWJ ON without trace. This allows JTAG or SW mode to be enabled by sending a specific sequence on the JTMS / JTCCK pin.

000: Full SWJ (JTAG-DP + SW-DP): Reset State

001: Full SWJ (JTAG-DP + SW-DP) but without NJTRST

010: JTAG-DP Disabled and SW-DP Enabled

100: JTAG-DP Disabled and SW-DP Disabled

Other combinations: no effect

Bits 23:17 Reserved.

Bit 15 PD01_REMAP : Port D0/Port D1 mapping on OSC_IN/OSC_OUT

This bit is set and cleared by software. It controls the mapping of PD0 and PD1 GPIO functionality. When the HSE oscillator is not used (application running on internal 8 MHz RC) PD0 and PD1 can be mapped on OSC_IN and OSC_OUT. This is available only on 48- and 64-pin packages (PD0 and PD1 are available on 100-pin packages, no need for remapping).

0: No remapping of PD0 and PD1

1: PD0 remapped on OSC_IN, PD1 remapped on OSC_OUT,

Bits 14:13 Reserved.

Bit 12 TIM4_REMAP : TIM4 remapping

This bit is set and cleared by software. It controls the mapping of TIM4 channels 1 to 4 onto the GPIO ports.

0: No remap (TIM4_CH1/PB6, TIM4_CH2/PB7, TIM4_CH3/PB8, TIM4_CH4/PB9)

1: Full remap (TIM4_CH1/PD12, TIM4_CH2/PD13, TIM4_CH3/PD14, TIM4_CH4/PD15)

Note: TIM4_ETR on PE0 is not re-mapped.

Bits 11:10 TIM3_REMAP[1:0] : TIM3 remapping

These bits are set and cleared by software. They control the mapping of TIM3 channels 1 to 4 on the GPIO ports.

00: No remap (CH1/PA6, CH2/PA7, CH3/PB0, CH4/PB1)

01: Not used

10: Partial remap (CH1/PB4, CH2/PB5, CH3/PB0, CH4/PB1)

11: Full remap (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9)

Note: TIM3_ETR on PE0 is not re-mapped.

Bits 9:8 TIM2_REMAP[1:0]: TIM2 remapping

These bits are set and cleared by software. They control the mapping of TIM2 channels 1 to 4 and external trigger (ETR) on the GPIO ports.

00: No remap (CH1/ETR/PA0, CH2/PA1, CH3/PA2, CH4/PA3)

01: Partial remap (CH1/ETR/PA15, CH2/PB3, CH3/PA2, CH4/PA3)

10: Partial remap (CH1/ETR/PA0, CH2/PA1, CH3/PB10, CH4/PB11)

11: Full remap (CH1/ETR/PA15, CH2/PB3, CH3/PB10, CH4/PB11)

Bits 7:6 TIM1_REMAP[1:0]: TIM1 remapping

These bits are set and cleared by software. They control the mapping of TIM1 channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN) on the GPIO ports.

00: No remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PB12, CH1N/PB13, CH2N/PB14, CH3N/PB15)

01: Partial remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PA6, CH1N/PA7, CH2N/PB0, CH3N/PB1)

10: not used

11: Full remap (ETR/PE7, CH1/PE9, CH2/PE11, CH3/PE13, CH4/PE14, BKIN/PE15, CH1N/PE8, CH2N/PE10, CH3N/PE12)

Bits 5:4 USART3_REMAP[1:0]: USART3 remapping

These bits are set and cleared by software. They control the mapping of USART3 CTS, RTS, CK, TX and RX alternate functions on the GPIO ports.

00: No remap (TX/PB10, RX/PB11, CK/PB12, CTS/PB13, RTS/PB14)

01: Partial remap (TX/PC10, RX/PC11, CK/PC12, CTS/PB13, RTS/PB14)

10: not used

11: Full remap (TX/PD8, RX/PD9, CK/PD10, CTS/PD11, RTS/PD12)

Bit 3 USART2_REMAP: USART2 remapping

This bit is set and cleared by software. It controls the mapping of USART2 CTS, RTS, CK, TX and RX alternate functions on the GPIO ports.

0: No remap (CTS/PA0, RTS/PA1, TX/PA2, RX/PA3, CK/PA4)

1: Remap (CTS/PD3, RTS/PD4, TX/PD5, RX/PD6, CK/PD7)

Bit 2 USART1_REMAP: USART1 remapping

This bit is set and cleared by software. It controls the mapping of USART1 TX and RX alternate functions on the GPIO ports.

0: No remap (TX/PA9, RX/PA10)

1: Remap (TX/PB6, RX/PB7)

Bit 1 I2C1_REMAP: I2C1 remapping

This bit is set and cleared by software. It controls the mapping of I2C1 SCL and SDA alternate functions on the GPIO ports.

0: No remap (SCL/PB6, SDA/PB7)

1: Remap (SCL/PB8, SDA/PB9)

Bit 0 SPI1_REMAP: SPI1 remapping

This bit is set and cleared by software. It controls the mapping of SPI1 NSS, SCK, MISO, MOSI alternate functions on the GPIO ports.

0: No remap (NSS/PA4, SCK/PA5, MISO/PA6, MOSI/PA7)

1: Remap (NSS/PA15, SCK/PB3, MISO/PB4, MOSI/PB5)

7.4.3 External interrupt configuration register 1 (AFIO_EXTICR1)

Address offset: 0x08

Reset value: 0x0000

31302928272625242322212019181716
Reserved
1514131211109876543210
EXTI3[3:0]EXTI2[3:0]EXTI1[3:0]EXTI0[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved

Bits 15:0 EXTIx[3:0] : EXTI x configuration (x= 0 to 3)

These bits are written by software to select the source input for EXTIx external interrupt.

Refer to Section 8.2.5: External interrupt/event line mapping

0000: PA[x] pin

0001: PB[x] pin

0010: PC[x] pin

0011: PD[x] pin

0100: PE[x] pin

0101: PF[x] pin

0110: PG[x] pin

7.4.4 External interrupt configuration register 2 (AFIO_EXTICR2)

Address offset: 0x0C

Reset value: 0x0000

31302928272625242322212019181716
Reserved
1514131211109876543210
EXTI7[3:0]EXTI6[3:0]EXTI5[3:0]EXTI4[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved

Bits 15:0 EXTIx[3:0] : EXTI x configuration (x= 4 to 7)

These bits are written by software to select the source input for EXTIx external interrupt.

0000: PA[x] pin

0001: PB[x] pin

0010: PC[x] pin

0011: PD[x] pin

0100: PE[x] pin

0101: PF[x] pin

0110: PG[x] pin

7.4.5 External interrupt configuration register 3 (AFIO_EXTICR3)

Address offset: 0x10

Reset value: 0x0000

31302928272625242322212019181716
Reserved
1514131211109876543210
EXTI11[3:0]EXTI10[3:0]EXTI9[3:0]EXTI8[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved

Bits 15:0 EXTIx[3:0] : EXTI x configuration (x= 8 to 11)

These bits are written by software to select the source input for EXTIx external interrupt.

7.4.6 External interrupt configuration register 4 (AFIO_EXTICR4)

Address offset: 0x14

Reset value: 0x0000

31302928272625242322212019181716
Reserved
1514131211109876543210
EXTI15[3:0]EXTI14[3:0]EXTI13[3:0]EXTI12[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved

Bits 15:0 EXTIx[3:0] : EXTI x configuration (x= 12 to 15)

These bits are written by software to select the source input for EXTIx external interrupt.

7.4.7 AF remap and debug I/O configuration register (AFIO_MAPR2)

Address offset: 0x1C

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedMISC
_REMAP
TIM12_
REMAP
TIM67_
DAC_
DMA_
REMAP
FSMC
_NADV
TIM14_
REMAP
TIM13_
REMAP
ReservedTIM1_
DMA_
REMAP
CEC_
REMAP
TIM17_
REMAP
TIM16_
REMAP
rwrwrwrwrwrwrwrwrwrw

Bits 31:14 Reserved.

Bit 13 MISC_REMAP : Miscellaneous features remapping.

This bit is set and cleared by software. It controls miscellaneous features

The DMA2 channel 5 interrupt position in the vector table

The timer selection for DAC trigger 3 (TSEL[2:0] = 011, for more details refer to the DAC_CR register).

0: DMA2 channel 5 interrupt is mapped with DMA2 channel 4 at position 59, TIM5 TRGO event is selected as DAC Trigger 3, TIM5 triggers TIM1/3.

1: DMA2 channel 5 interrupt is mapped separately at position 60 and TIM15 TRGO event is selected as DAC Trigger 3, TIM15 triggers TIM1/3.

Note: This bit is available only in high density value line devices.

Bit 12 TIM12_REMAP : TIM12 remapping

This bit is set and cleared by software. It controls the mapping of the TIM12_CH1 and TIM12_CH2 alternate function onto the GPIO ports.

0: No remap (CH1/PC4, CH2/PC5)

1: Remap (CH1/PB12, CH2/PB13)

Note: This bit is available only in high density value line devices.

Bit 11 TIM76_DAC_DMA_REMAP : TIM67_DAC DMA remapping

This bit is set and cleared by software. It controls the mapping of the TIM6_DAC1 and TIM7_DAC2 DMA requests onto the DMA1 channels.

0: No remap (TIM6_DAC1 DMA request/DMA2 Channel3, TIM7_DAC2 DMA request/DMA2 Channel4)

1: Remap (TIM6_DAC1 DMA request/DMA1 Channel3, TIM7_DAC2 DMA request/DMA1 Channel4)

Bit 10 FSMC_NADV : NADV connect/disconnect

This bit is set and cleared by software. It controls the use of the optional FSMC_NADV signal.

0: The NADV signal is connected to the output (default)

1: The NADV signal is not connected. The I/O pin can be used by another peripheral.

Note: This bit is available only in high density value line devices.

Bit 9 TIM14_REMAP : TIM14 remapping

This bit is set and cleared by software. It controls the mapping of the TIM14_CH1 alternate function onto the GPIO ports.

0: No remap (PC9)

1: Remap (PB1)

Bit 8 TIM13_REMAP : TIM13 remapping

This bit is set and cleared by software. It controls the mapping of the TIM13_CH1 alternate function onto the GPIO ports.

0: No remap (PC8)

1: Remap (PB0)

Bits 7:5 Reserved.

Bit 4 TIM1_DMA_REMAP : TIM1 DMA remapping

This bit is set and cleared by software. It controls the mapping of the TIM1 channel 1 and channel 2 DMA requests onto the DMA1 channels.

0: No remap (TIM1_CH1 DMA request/DMA1 Channel2, TIM1_CH2 DMA request/DMA1 Channel3)

1: Remap (TIM1_CH1 DMA request/DMA1 Channel6, TIM1_CH2 DMA request/DMA1 Channel6)

Bit 3 CEC_REMAP : CEC remapping

This bit is set and cleared by software. It controls the mapping of the alternate functions of the CEC line onto the GPIO ports.

0: No remap (CEC/PB8)

1: Remap (CEC/PB10)

Bit 2 TIM17_REMAP : TIM17 remapping

This bit is set and cleared by software. It controls the mapping of the alternate functions of TIM17 channel 1 onto the GPIO ports.

0: No remap (CH1/PB9)

1: Remap (CH1/PA7)

Bit 1 TIM16_REMAP : TIM16 remapping

This bit is set and cleared by software. It controls the mapping of the alternate functions of TIM16 channel 1 onto the GPIO ports.

0: No remap (CH1/PB8)

1: Remap (CH1/PA6)

Bit 0 TIM15_REMAP : TIM15 remapping

This bit is set and cleared by software. It controls the mapping of the alternate functions of TIM15 channels 1 and 2 onto the GPIO ports.

0: No remap (CH1/PA2, CH2/PA3)

1: Remap (CH1/PB14, CH2/PB15)

7.5 GPIO and AFIO register maps

The following tables give the GPIO and AFIO register map and the reset values.

Refer to Table 1 on page 37 and Table 2 on page 38 for the register boundary addresses.

Table 48. GPIO register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
0x00GPIOx_CRLCNF7 [1:0]MODE7 [1:0]CNF6 [1:0]MODE6 [1:0]CNF5 [1:0]MODE5 [1:0]CNF4 [1:0]MODE4 [1:0]CNF3 [1:0]MODE3 [1:0]CNF2 [1:0]MODE2 [1:0]CNF1 [1:0]MODE1 [1:0]CNF0 [1:0]MODE0 [1:0]
01000100010001000100010001000100
0x04GPIOx_CRHCNF15 [1:0]MODE15 [1:0]CNF14 [1:0]MODE14 [1:0]CNF13 [1:0]MODE13 [1:0]CNF12 [1:0]MODE12 [1:0]CNF11 [1:0]MODE11 [1:0]CNF10 [1:0]MODE10 [1:0]CNF9 [1:0]MODE9 [1:0]CNF8 [1:0]MODE8 [1:0]
01000100010001000100010001000100
0x08GPIOx_IDRReservedIDRy
0000000000000000
0x0CGPIOx_ODRReservedODRy
0000000000000000
0x10GPIOx_BSRRBR[15:0]BSR[15:0]
00000000000000000000000000000000
0x14GPIOx_BRRReservedBR[15:0]
0000000000000000
0x18GPIOx_LCKRReservedLCKKLCK[15:0]
00000000000000000

Table 49. AFIO register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
0x00AFIO_EVCRReservedEVOEPORT[2:0]PIN[3:0]
00000000
0x04AFIO_MAPRReservedSWJ_CFG[2:0]ReservedTIM5CH4_IREMAPPD01_REMAPReservedTIM4_REMAPTIM3_REMAP[1:0]TIM2_REMAP[1:0]TIM1_REMAP[1:0]USART3_REMAP[1:0]USART2_REMAPUSART1_REMAPI2C1_REMAPSPI1_REMAP
0000000000000000000

Table 49. AFIO register map and reset values (continued)

OffsetRegister313029282726252423222120191817161514131211109876543210
0x08AFIO_EXTICR1ReservedEXTI3[3:0]EXTI2[3:0]EXTI1[3:0]EXTI0[3:0]
Reset value0000000000000000
0x0CAFIO_EXTICR2ReservedEXTI7[3:0]EXTI6[3:0]EXTI5[3:0]EXTI4[3:0]
Reset value0000000000000000
0x10AFIO_EXTICR3ReservedEXTI11[3:0]EXTI10[3:0]EXTI9[3:0]EXTI8[3:0]
Reset value0000000000000000
0x14AFIO_EXTICR4ReservedEXTI15[3:0]EXTI14[3:0]EXTI13[3:0]EXTI12[3:0]
Reset value0000000000000000
0x1CAFIO_MAPR2ReservedMISC_REMAPTIM12_REMAPTIM67_DAC_DMA_REMAPFSMC_NADVTIM14_REMAPTIM13_REMAPRes.TIM1_DMA_REMAPCEC_REMAPTIM17_REMAPTIM16_REMAPTIM15_REMAP
Reset value00000000000