Hide thumbs Also See for AT32F421:

Advertisement

Quick Links

Introduction
AT32F421xx general-purpose I/Os (GPIOs) 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 multiplexed 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:
AT32F421_Firmware_Library_V2.x.x\project\at_start_f421\examples\gpio
GPIO and IOMUX section in the reference manual of AT32F421
The code in this application note is based on Artery's V2.x.x BSP (the version of board support
Note:
package). When in use, attention should be paid to the differences regarding to the versions of
BSP.
Applicable products:
MCU
2021.11.29
AT32F421 GPIO user guide
AT32F421 GPIO user guide
AT32F421xx
1
AN0069
Application Note
Rev.2.0.0
www.arterytek.com

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Summary of Contents for ARTERY AT32F421

  • Page 1  GPIO and IOMUX section in the reference manual of AT32F421 The code in this application note is based on Artery’s V2.x.x BSP (the version of board support Note: package). When in use, attention should be paid to the differences regarding to the versions of BSP.
  • 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 IOMUX ........................
  • 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 2021.11.29 Rev.2.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 multiplexed functions of GPIOs 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 CFGR[1:0] OMODE ODRVR[1:0] PULL[1:0] 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 Multiplexed 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: Iomux

    AT32F421 GPIO user guide IOMUX I/O multiplexed 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: Table 6. Configure Port B Alternate Function By Gpiob_Afr Register

    AT32F421 GPIO user guide Table 6. Configure port B multiplexed function by GPIOB_MUX register MUX0 MUX1 MUX2 MUX3 MUX4 MUX5 MUX6 MUX7 name USART2_R EVENTOUT TMR3_CH3 TMR1_CH2N I2S1_MCLK SPI2_SCK/I2S2_ TMR14_CH1 TMR3_CH4 TMR1_CH3N TMR3_ETR SPI1_SCK/I2S1_ SPI2_SCK/I2S2_ EVENTOUT SPI1_MISO/I2S1 TMR17_B SPI2_MISO/I2S2 TMR3_CH1...
  • Page 12: Special I/Os

     The following contents are not available in AT32F421 series: Analog switch (power switch) can only allow a small amount of current (3mA), so in output mode, there are some limits on using I/O functions of PC13/PC14/PC15: they can only work in...
  • Page 13: Gpio Firmware Driver Api

    AT32F4xx_StdPeriph_Lib_Vx.x.x\Libraries\AT32F4xx_StdPeriph_Driver Note: The AT32F421 series GPIOs use different driver at32f4xx_gpio.c/.h from that of other series. The user should be noted about this when using. Output mode GPIO provides two different types of output modes: push-pull and open-drain. Refer to the following configuration example of output mode.
  • 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: Usart I/O Multiplexed Function Mode Configuration

    AT32F421 GPIO user guide USART I/O multiplexed function mode configuration /* Enable GPIOA clock */ crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE); /* Connect PA9 to USART1_Tx */ gpio_pin_mux_config(GPIOA, GPIO_PINS_SOURCE9, GPIO_MUX_1); /* Connect PA10 to USART1_Rx */ gpio_pin_mux_config(GPIOA, GPIO_PINS_SOURCE10, GPIO_MUX_1); /* Configure USART1_Tx and USART1_Rx as multiplexed function*/ gpio_init_struct.gpio_pins = GPIO_PINS_9 | GPIO_PINS_10;...
  • Page 16: I2C I/O Multiplexed Function Mode Configuration

    AT32F421 GPIO user guide I2C I/O multiplexed function mode configuration /* Enable GPIOB clock */ crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE); /* Connect PB6 to I2C1_SCL */ gpio_pin_mux_config(GPIOB, GPIO_PINS_SOURCE6, GPIO_MUX_1); /* Connect PB7 to I2C1_SDA */ gpio_pin_mux_config(GPIOB, GPIO_PINS_SOURCE7, GPIO_MUX_1); /* Configure I2C1_SCL and I2C1_SDA as multiplexed function. Note that I2C pin output mode should be as open-drain output */ gpio_init_struct.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 2021.11.29 2.0.0 Initial release 2021.11.29 Rev.2.0.0 www.arterytek.com...
  • Page 18 No license, express or implied, to any intellectual property rights is granted under this document. If any part of this document deals with any third party products or services, it shall not be deemed a license grant by ARTERY for the use of such third party products or services, or any intellectual property contained therein, or considered as a warranty regarding the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.

Table of Contents