</>EmbeddedInterview

Explain AMBA, AXI, AHB and APB bus architectures.

MediumARM Architecture

AMBA (Advanced Microcontroller Bus Architecture) is an open standard developed by Arm for communication between hardware components inside a System-on-Chip (SoC).

It defines how the CPU, GPU, DMA, memory controller and peripherals communicate with each other.

AMBA is a family of bus protocols, including:

  • AXI: Advanced eXtensible Interface.
  • AHB: Advanced High-performance Bus.
  • APB: Advanced Peripheral Bus.
  • ACE: AXI Coherency Extensions.
  • CHI: Coherent Hub Interface.

1. AMBA SoC architecture

ARM CPUGPUDMAAXI InterconnectHigh-performance communicationDDR ControllerDRAMAXI-to-AHB BridgeAHB BusSRAM / FlashAHB-to-APB BridgeAPB BusUARTI2CSPIGPIOTimer
Example SoC architecture. Actual bus connections depend on the SoC design.
Protocol Performance Typical usage
AXI Very high CPU, GPU, DMA, DDR
AHB High SRAM, Flash, microcontrollers
APB Low UART, GPIO, I2C, timers

2. AXI — Advanced eXtensible Interface

AXI is a high-performance protocol designed for high-bandwidth, low-latency communication.

It is commonly used between:

  • CPU and DDR controller.
  • GPU and memory.
  • DMA and memory.
  • Display controller and framebuffer.
  • High-performance hardware accelerators.
AXI has five independent channels
MasterCPUSlaveDDR CtrlAW — Write addressW — Write dataB — Write responseAR — Read addressR — Read data
Channel Purpose
AW Write address
W Write data
B Write response
AR Read address
R Read data and response

Each channel uses an independent VALID and READY handshake. A transfer occurs on a rising clock edge when both signals are asserted.

Example: CPU reads from DDR
uint32_t value = *ptr;

ARM assembly:

LDR W0, [X1]

Assuming a cache miss requiring an external AXI transaction:

  1. MMU translates the virtual address into a physical address.
  2. CPU memory subsystem generates an AXI read request.
  3. ARADDR contains the physical address.
  4. ARVALID is asserted.
  5. The receiving interface asserts ARREADY.
  6. The DDR controller retrieves the requested data.
  7. RDATA contains the returned data.
  8. RVALID and RREADY complete the data transfer.
  9. CPU receives the data and completes the load instruction.
Example: AXI burst transfer

Suppose a DMA controller reads 64 bytes using a 64-bit AXI data bus.

Data bus width = 8 bytes
Burst length   = 8 transfers

ARLEN   = 7
ARSIZE  = 3
ARBURST = INCR

The starting address is transmitted once, followed by eight data transfers.

Starting address: 0x80000000D0D1D2D3D4D5D6D78 transfers × 8 bytes = 64 bytes

Advantages of AXI:

  • Independent read and write channels.
  • Multiple outstanding transactions.
  • Burst transfers.
  • Out-of-order completion where ordering rules permit.
  • High bandwidth and scalability.

AXI4-Lite is a simplified AXI protocol commonly used for control register access without burst transfers.

3. AHB — Advanced High-performance Bus

AHB is a high-performance pipelined bus commonly used in Cortex-M microcontrollers and embedded systems.

Typical connections include CPU, DMA, SRAM, Flash and peripheral bridges.

Important AHB signals
Signal Purpose
HADDR Address
HWRITE Read or write selection
HTRANS Transfer type
HSIZE Transfer size
HBURST Burst type
HWDATA Write data
HRDATA Read data
HREADY Transfer completion
HRESP Transfer response
How AHB pipelining works

AHB overlaps the address phase of the next transaction with the data phase of the current transaction.

Cycle 1Cycle 2Cycle 3Cycle 4AddressDataA1D1A2D2A3D3
Ideal pipelined transfer without wait states.

In cycle 2, the bus transfers data for address A1 while simultaneously transmitting address A2.

If the slave is not ready, HREADY is deasserted, extending the transfer.

AHB-Lite simplifies AHB by supporting a single master per bus interface.

4. APB — Advanced Peripheral Bus

APB is a simple, low-power protocol designed primarily for accessing peripheral registers.

It is commonly used for:

  • UART.
  • I2C and SPI controllers.
  • GPIO.
  • Timers.
  • Watchdog.
  • RTC.

APB does not support pipelining or burst transactions.

Important APB signals
Signal Purpose
PADDR Peripheral register address
PSEL Peripheral selection
PENABLE Access phase enable
PWRITE Read/write selection
PWDATA Write data
PRDATA Read data
PREADY Peripheral ready
PSLVERR Peripheral error response
APB transfer has two phases
  1. Setup phase: PSEL = 1, PENABLE = 0.
  2. Access phase: PSEL = 1, PENABLE = 1.

The transfer completes when PREADY is asserted during the access phase.

IdleSetupAccessPCLKPSELPENABLEPREADYPADDRValid addressTransfer completes at phase end

Minimum transfer duration is two APB clock cycles. Additional wait states are possible.

5. Real-world example: CPU writes to a GPIO register

Consider an embedded C program:

#define GPIO_REG (*(volatile uint32_t *)0x40020014U)

GPIO_REG = 0x20;

Representative ARM assembly:

LDR R0, =0x40020014
MOV R1, #0x20
STR R1, [R0]

Assuming the GPIO is connected through an APB bridge:

CPU executes STRAddress = 0x40020014, Data = 0x20AXI interconnectAddress decoding and routingAXI-to-AHB bridgeProtocol conversionAHB-to-APB bridgeGenerates APB control signalsGPIO controllerUpdates output registerGPIO physical pinOutput changes according to configuration

At the hardware level:

  1. CPU executes the STR instruction.
  2. The interconnect decodes the physical address.
  3. The appropriate bridge converts the transaction into APB signals.
  4. PADDR = 0x40020014 (or the corresponding local peripheral address).
  5. PWDATA = 0x20.
  6. PWRITE = 1.
  7. PSEL = 1.
  8. PENABLE = 1 in the next phase.
  9. GPIO controller accepts the data.
  10. PREADY completes the APB transaction.
  11. GPIO output register is updated.

The addresses and bridge arrangement are illustrative and depend on the actual SoC memory map.

6. How AMBA supports ARM TrustZone

This is particularly important in Secure Touch and Secure Display implementations.

AXI contains protection signals:

ARPROT[1] — Read security attribute
AWPROT[1] — Write security attribute

0 = Secure
1 = Non-secure

For example, if the non-secure Linux kernel tries to access a protected I2C controller:

value = readl(i2c_base + offset);
LDR W0, [X1]

The transaction flows as:

Non-secure CPU
      ↓
AXI read transaction
ARPROT[1] = 1
      ↓
Hardware security controller
      ↓
Access denied to secure peripheral

The hardware firewall checks the security attribute and can reject unauthorized transactions.

APB4 and later also support protection attributes through PPROT.

AMBA carries security attributes; the hardware access-control logic enforces security permissions.

7. AXI vs AHB vs APB

Feature AXI4 AHB / AHB-Lite APB
Performance Very high High Low
Complexity High Medium Low
Pipelining Yes Yes No
Burst transfer Yes Yes No
Independent read/write channels Yes No No
Multiple outstanding transactions Yes No, AXI-style No
Out-of-order completion Supported No No
Power/area overhead Generally higher Moderate Generally lower
Typical processor Cortex-A Cortex-M Peripheral interfaces
Typical usage DDR, GPU, DMA SRAM, Flash GPIO, UART, I2C

8. ACE and CHI

Two additional AMBA protocols are important in multicore systems.

Protocol Purpose
ACE Extends AXI with hardware cache coherency support.
CHI Scalable, packet-based coherent communication for complex multicore SoCs.

Standard AXI alone does not provide full hardware cache coherency. ACE and CHI provide mechanisms for coherent transactions between processors and other participating components.

9. Important interview points

  • AMBA: Family of on-chip communication protocols.
  • AXI: Five independent channels for high-performance communication.
  • AHB: Overlapping address and data phases through pipelining.
  • APB: Simple two-phase peripheral register access.
  • Bridge: Converts one bus protocol into another.
  • Interconnect: Performs address decoding, transaction routing and arbitration.
  • ACE/CHI: Hardware cache coherency.

Official reference: Arm AMBA Protocol Specifications.