Advertisement

Quick Links

Introduction
AT32F421xx general-purpose I/Os provide a wide range of interfaces to achieve digital or analog
communications between MCU and 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 one peripheral at a certain time so as to avoid
conflicts among peripherals.
Reference materials:
AT32F4xx_StdPeriph_Lib_V1.x.x\Project\AT_START_F421\Examples\GPIO
GPIO section in the reference manual of AT32F421
Applicable products:
Part number
2020.07.30
AT32F421 GPIO user guide
AT32F421 GPIO user guide
AT32F421xx
1
AN0069
Application Note
Rev.1.0.0
www.arterytek.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AT32F421 GPIO and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for ARTERY AT32F421 GPIO

  • Page 1 AT32F421 GPIO user guide AN0069 Application Note AT32F421 GPIO user guide Introduction AT32F421xx general-purpose I/Os provide a wide range of interfaces to achieve digital or analog communications between MCU and 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 one peripheral at a certain time so as to avoid conflicts among peripherals.
  • Page 2: Table Of Contents

    AT32F421 GPIO user guide Contents GPIO features ......................5 GPIO ........................6 GPIO toggle ......................8 5V-tolerant or 3V-tolerant IO ..................8 Standard 3.3V-tolerant pins (TC) ................. 8 5V-tolerant pin with analog function (FTa) ..............8 5V-tolerant pin (FT) ...................... 9 AFIO ........................
  • Page 3 AT32F421 GPIO user guide List of tables Table 1. I/O port bit configuration table ....................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.
  • Page 4 AT32F421 GPIO user guide List of figures Figure 1. Basic structure of I/O port bit ....................6 Figure 2. I/O toggle speed ........................8 2020.07.30 Rev.1.0.0 www.arterytek.com...
  • Page 5: Gpio Features

    AT32F421 GPIO user guide GPIO features  48-pin package (largest) has 39 multi-function bidirectional I/O ports  All I/O ports can be mapped to 16 external interrupt vectors  Almost all I/O ports are 5V tolerant (except for 4x OSC/OSC32 pins) ...
  • Page 6: Gpio

    AT32F421 GPIO user guide GPIO During and just after reset, the alternate functions are not active and most I/O ports are configured in input floating mode. When configured as output, the value written to the output data register (GPIOx_OPTDT) is output on the I/O pin.
  • Page 7: Table 1. I/O Port Bit Configuration Table

    AT32F421 GPIO user guide Table 1. I/O port bit configuration table MODER[1:0] OTYPER ODRVR[1:0] PUPDR[1:0] I/O configuration GP output GP output GP output Reserved GP output GP output GP output Reserved (GP output OD) ODRV[1:0] AF output AF output AF output...
  • Page 8: Gpio Toggle

    AT32F421 GPIO user guide GPIO toggle All I/O ports of AT32F421 series are fast I/Os with control registers accessible at f speed so that the GPIO toggle frequency can reach 60 MHz with ease. Figure 2. I/O toggle speed 5V-tolerant or 3V-tolerant IO Standard 3.3V-tolerant pins (TC)
  • Page 9: Tolerant Pin (Ft)

    AT32F421 GPIO user guide Table 3. FTa pin example Pin name Pin name IO structure Alternate function Additional function TMR1_ETR / ADC_IN0COMP_INP2 USART2_CTS / COMP_INM6 / /I2C2_SCL / WKUP1 COMP_OUT 5V-tolerant pin (FT) Other GPIOs are all 5V tolerant. Table 4. FT pin example...
  • Page 10: Afio

    AT32F421 GPIO user guide 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.
  • Page 11: Special I/Os

    AT32F421 GPIO user guide Table 6. Configure port B alternate function by GPIOB_AFR register name EVENTOUT TMR3_CH3 TMR1_CH2N USART2_RX I2S1_MCK SPI2_SCK/ TMR14_CH1 TMR3_CH4 TMR1_CH3N I2S2_CK TMR3_ETR SPI1_SCK/ SPI2_SCK/ EVENTOUT I2S1_CK I2S2_CK SPI1_MISO/ SPI2_MISO/ TMR3_CH1 EVENTOUT TMR17_BKIN I2C2_SDA I2S1_MCK I2S2_MCK SPI1_MOSI/...
  • Page 12: Oscillator Alternate Function Pin

    AT32F421 GPIO user guide  PA13: SWDIO, AF pull-up  PA14: SWCLK, AF pull-down Oscillator alternate function pin  When the oscillator is OFF (default state after reset), related pins can be used as GPIO  When the oscillator is enabled, the GPIO configuration of the related pins is invalid ...
  • Page 13: Gpio Firmware Driver Api

    AT32F421 GPIO user guide GPIO firmware driver API Artery’s firmware driver contains a series of firmware functions to manage the following GPIO functions:  Initialization configuration  Read input ports or certain input pin  Read output ports or certain output pin ...
  • Page 14: Analog Mode

    AT32F421 GPIO user guide Analog mode When the user needs to use ADC or COMP channel as input, it is necessary to configure the corresponding pins as analog mode. Refer to the following configuration example of analog mode. GPIO_InitStructure.GPIO_Pins = GPIO_Pins_x;...
  • Page 15: Tmr I/O Alternate Function Mode Configuration

    AT32F421 GPIO user guide /* Connect PA9 to USART1_Tx */ GPIO_PinAFConfig(GPIOA, GPIO_PinsSource9, GPIO_AF_1); /* Connect PA10 to USART1_Rx */ GPIO_PinAFConfig(GPIOA, GPIO_PinsSource10, GPIO_AF_1); /* Configure USART2_Tx and USART2_Rx as alternate functions */ GPIO_InitStructure.GPIO_Pins = GPIO_Pins_9 | GPIO_Pins_10; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OutType = GPIO_OutType_PP;...
  • Page 16 AT32F421 GPIO user guide /* Connect PB6 to TMR1_BKIN */ GPIO_PinAFConfig(GPIOB, GPIO_PinsSource6, GPIO_AF_1); /* Connect PB7 to TMR1_CH1 */ GPIO_PinAFConfig(GPIOB, GPIO_PinsSource7, 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;...
  • Page 17: Revision History

    AT32F421 GPIO user guide Revision history Document revision history Table 8. Date Revision Changes 2020.07.30 1.0.0 Initial release 2020.07.30 Rev.1.0.0 www.arterytek.com...
  • Page 18 Purchasers hereby agrees that Artery’s products are not authorized for use as, and purchasers shall not integrate, promote, sell or otherwise transfer any Artery’s product to any customer or end user for use as critical components in (a) any medical, life saving or life support device...

Table of Contents