Introduction

The GPIO module is a programmable peripheral that provides flexible control of external I/O pad signals.

The chip integrates multiple independent GPIO controllers, organized as PORT_A, PORT_B, etc. Each port supports the following primary per-pin functions: direction control (input or output), output data control and input state readback via memory-mapped registers, and external interrupt detection for event-driven system response. Within each port, every pin operates independently, allowing fine-grained configuration and monitoring of I/O signals.

Each port contains multiple groups of registers, including basic I/O control registers (GPIO_DR, GPIO_DDR, GPIO_EXT_PORT), interrupt control registers (GPIO_INT_XXX), and debounce control register (GPIO_DB_DIV_CONFIG). The debounce function is controlled at the group level, while all other registers provide bit-level control, with each bit corresponding to an individual GPIO pin.

Features

RTL8721Dx:
  • Up to 64 pins

    • PortA: PA0 ~ PA31

    • PortB: PB0 ~ PB31

  • Independent register control

    • Separate data register and data direction register for each GPIO signal

  • Flexible interrupt modes

    • Selectable level-sensitive interrupt detection

    • Selectable edge-triggered interrupt detection

  • Debounce capability

    • Configurable debounce circuitry with slow clock source

    • Effective noise filtering for interrupt pins

Block Diagram

The block diagram of GPIO is illustrated below.

../../../_images/block_diagram1.svg

The GPIO block consists of the following main functional interface groups:

  • APB Interface: Connects to the APB bridge for memory-mapped register access, enabling software configuration and control of GPIO functionality.

  • External Data Interface: Interfaces directly with physical I/O pads to drive output signals or sample input data from external pins.

  • Interrupt Interface: Generates interrupt requests to the system interrupt controller when configured GPIO events occur, and receives interrupt acknowledgment signals.