ARTERY AT32F421 GPIO User Manual Download Page 10

  AT32F421  GPIO  user  guide

 

2020.07.30 

10 

Rev.1.0.0 

www.arterytek.com 

 

AFIO 

 

I/O alternate function input/output 

 

Most peripherals share the same GPIO pin (For example, PA0 can be used as TMR1_ETR / 

USART2_CTS /I2C2_SCL / COMP_OUT) 

 

A GPIO pin is connected to only one peripheral at any time. 

 

Some peripheral functions can also be remapped to other pins so as to get more peripherals 

that can be used at the same time 

Selecting one of the active alternate functions on each port line is determined by GPIOx_AFRL or 

GPIOx_AFRH alternate function register. The user can use these two registers to connect alternate 

function module to other pins according to the application requirements. 

Table 5. Configure port A alternate function by GPIOA_AFR register 

Pin 

name 

AF0 

AF1 

AF2 

AF3 

AF4 

AF5 

AF6 

AF7 

PA0 

USART2_CTS 

I2C2_SCL 

TMR1_ETR 

COMP_OUT 

PA1 

EVENTOUT 

USART2_RTS 

I2C2_SDA 

TMR15_CH1N 

PA2 

TMR15_CH1 

USART2_TX 

PA3 

TMR15_CH2 

USART2_RX 

I2S2_MCK 

PA4 

SPI1_NSS/ 

I2S1_WS 

USART2_CK 

TMR14_CH1 

PA5 

SPI1_SCK/ 

I2S1_CK 

PA6 

SPI1_MISO/ 

I2S1_MCK 

TMR3_CH1 

TMR1_BKIN 

I2S2_MCK 

TMR16_CH1 

EVENTOUT 

COMP_OUT 

PA7 

SPI1_MOSI/ 

I2S1_SD 

TMR3_CH2 

TMR1_CH1N 

TMR14_CH1 

TMR17_CH1 

EVENTOUT 

PA8 

CLKOUT 

USART1_CK 

TMR1_CH1 

EVENTOUT 

USART2_TX 

I2C2_SCL 

PA9 

TMR15_BKIN 

USART1_TX 

TMR1_CH2 

I2C1_SCL 

CLKOUT 

I2C2_SMBA 

PA10 

TMR17_BKIN 

USART1_RX 

TMR1_CH3 

I2C1_SDA 

PA11 

EVENTOUT 

USART1_CTS 

TMR1_CH4 

I2C1_SMBA 

I2C2_SCL 

COMP_OUT 

PA12 

EVENTOUT 

USART1_RTS 

TMR1_ETR 

I2C2_SDA 

PA13 

SWDIO 

IR_OUT 

SPI2_MISO/

I2S2_MCK 

PA14 

SWCLK 

USART2_TX 

SPI2_MOSI/

I2S2_SD 

PA15 

SPI1_NSS/ 

I2S1_WS 

USART2_RX 

EVENTOUT 

SPI2_NSS/ 

I2S2_WS 

 

Summary of Contents for AT32F421 GPIO

Page 1: ...nd other embedded devices Besides AT32F421 series GPIOs feature rich I O alternate functions to enable multiple peripherals to work at the same time and make sure that each pin is connected to only on...

Page 2: ...pin FT 9 AFIO 10 I O alternate function input output 10 Special I Os 11 Debug alternate function pin 11 Oscillator alternate function pin 12 Backup domain pin 12 GPIO firmware driver API 13 Output mo...

Page 3: ...7 Table 2 TC pin example 8 Table 3 FTa pin example 9 Table 4 FT pin example 9 Table 5 Configure port A alternate function by GPIOA_AFR register 10 Table 6 Configure port B alternate function by GPIOB_...

Page 4: ...AT32F421 GPIO user guide 2020 07 30 4 Rev 1 0 0 www arterytek com List of figures Figure 1 Basic structure of I O port bit 6 Figure 2 I O toggle speed 8...

Page 5: ...rs accessible with fAHB speed The peripheral function of the I O pin can be locked through a specific operation to avoid unwanted writing to I O registers Each GPIO pin can be individually configured...

Page 6: ...IOx_OPTDT is output on the I O pin It is possible to use the output driver in push pull mode or open drain mode only low level is activated while the high level shows high impedance The input data reg...

Page 7: ...ut PP 0 1 1 Reserved 1 0 0 GP output OD 1 0 1 GP output OD 1 1 0 GP output OD 1 1 1 Reserved GP output OD 10 0 0 0 AF output PP 0 0 1 AF output PP 0 1 0 AF output PP 0 1 1 Reserved 1 0 0 AF output OD...

Page 8: ...V tolerant pins PC14 PC15 OSC32_IN OUT PF0 PF1 OSC_IN OUT Table 2 TC pin example Pin name Pin name IO structure Alternate function Additional function PF0 OSC_IN PF0 I O TC I2C1_SDA OSC_IN 5V tolerant...

Page 9: ...rnate function Additional function PA0 I O FTa TMR1_ETR USART2_CTS I2C2_SCL COMP_OUT ADC_IN0COMP_INP2 COMP_INM6 WKUP1 5V tolerant pin FT Other GPIOs are all 5V tolerant Table 4 FT pin example Pin name...

Page 10: ...ts Table 5 Configure port A alternate function by GPIOA_AFR register Pin name AF0 AF1 AF2 AF3 AF4 AF5 AF6 AF7 PA0 USART2_CTS I2C2_SCL TMR1_ETR COMP_OUT PA1 EVENTOUT USART2_RTS I2C2_SDA TMR15_CH1N PA2...

Page 11: ...I2C1_SCL TMR16_CH1N I2S1_MCK PB7 USART1_RX I2C1_SDA TMR17_CH1N PB8 I2C1_SCL TMR16_CH1 PB9 IR_OUT I2C1_SDA TMR17_CH1 EVENTOUT I2S1_MCK SPI2_NSS I2S2_WS PB10 I2C2_SCL SPI2_SCK I2S2_CK PB11 EVENTOUT I2C...

Page 12: ...C_OUT OSC32_OUT can be used as GPIO Backup domain pin When 1 2V domain is powered off when the device enters standby mode PC13 PC14 PC15 lost their GPIO functions In this case if GPIO is not configure...

Page 13: ...Output mode GPIO provides two different types of output modes push pull and open drain Refer to the following configuration example of output mode GPIO_InitStructure GPIO_Pins GPIO_Pins_x GPIO_InitStr...

Page 14: ...GPIO_PinAFConfig function After reset all I Os are connected to the system alternate function 0 AF0 Configure AF1 to AF7 to map peripherals alternate functions 3 In addition to these flexible I O alte...

Page 15: ...ration Enable AHB interface clock of GPIOA RCC_AHBPeriphClockCmd RCC_AHBPERIPH_GPIOA ENABLE Connect PA6 to TMR1_BKIN GPIO_PinAFConfig GPIOA GPIO_PinsSource6 GPIO_AF_2 Connect PA8 to TMR1_CH1 GPIO_PinA...

Page 16: ...sSource7 GPIO_AF_1 Configure I2C1_SCL and I2C1_SDA as alternate functions Note that I2C pin should be open drain output GPIO_InitStructure GPIO_Pins GPIO_Pins_6 GPIO_Pins_7 GPIO_InitStructure GPIO_Mod...

Page 17: ...AT32F421 GPIO user guide 2020 07 30 17 Rev 1 0 0 www arterytek com Revision history Table 8 Document revision history Date Revision Changes 2020 07 30 1 0 0 Initial release...

Page 18: ...otherwise a license to use third party s products and services or b licensing the third parties intellectual property rights or c warranting the third party s products and services and its intellectu...

Reviews: