BCM2711
BCM2711
Table of Contents
Colophon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.2. Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3. BSC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.3.1. Writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.3.2. Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4. DMA Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
ii Release 1
BCM2711 ARM Peripherals
Copyright 2012 Broadcom Europe Ltd., 2020 Raspberry Pi (Trading) Ltd.
5.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
6. Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
iii Release 1
BCM2711 ARM Peripherals
Copyright 2012 Broadcom Europe Ltd., 2020 Raspberry Pi (Trading) Ltd.
9. SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
iv Release 1
BCM2711 ARM Peripherals
Copyright 2012 Broadcom Europe Ltd., 2020 Raspberry Pi (Trading) Ltd.
Colophon
BCM2711 ARM Peripherals, based in large part on the earlier BCM2835 ARM Peripherals documentation.
Colophon 1 Release 1
BCM2711 ARM Peripherals
Copyright 2012 Broadcom Europe Ltd., 2020 Raspberry Pi (Trading) Ltd.
List of Figures
Figure 1 . . . . . BCM2711 Address Maps
Figure 2 . . . . . Write to a slave with 10-bit address
Figure 3 . . . . . Read from slave with 10-bit address
Figure 4 . . . . . GPIO Block Diagram
Figure 5 . . . . . Interrupt sources and destinations
Figure 6 . . . . . Peripheral IRQ OR-ing
Figure 7 . . . . . GIC IRQ routing
Figure 8 . . . . . Legacy IRQ routing
Figure 9 . . . . . Legacy IRQ status registers
Figure 10 . . . . PCM Audio Interface Typical Timing
Figure 11 . . . . PCM Audio Interface Block Diagram
Figure 12 . . . . Timing at Start of Frame
Figure 13 . . . . Gray mode input format
Figure 14 . . . . PWM block diagram
Figure 15 . . . . Serial bit transmission when M/S Mode enabled
Figure 16 . . . . SPI Master Typical Usage
Figure 17 . . . . SPI Cycle
Figure 18 . . . . Different Clock Polarity/Phase
Figure 19 . . . . Bidirectional SPI Master Typical Usage
Figure 20 . . . . LoSSI mode Typical usage
Figure 21 . . . . Serial interface Block Diagram
List of Tables
Table 1 . . . . . Release History
Table 2 . . . . . Auxiliary peripherals Address Map
Table 3 . . . . . AUX_IRQ Register
Table 4 . . . . . AUX_ENABLES Register
Table 5 . . . . . AUX_MU_IO_REG Register
Table 6 . . . . . AUX_MU_IER_REG Register
Table 7 . . . . . AUX_MU_IIR_REG Register
Table 8 . . . . . AUX_MU_LCR_REG Register
Table 9 . . . . . AUX_MU_MCR_REG Register
Table 10 . . . . AUX_MU_LSR_REG Register
Table 11 . . . . AUX_MU_MSR_REG Register
Table 12 . . . . AUX_MU_SCRATCH Register
Table 13 . . . . AUX_MU_CNTL_REG Register
Table 14 . . . . AUX_MU_STAT_REG Register
Table 15 . . . . AUX_MU_BAUD_REG Register
Table 16 . . . . AUX_SPI1_CNTL0_REG & AUX_SPI2_CNTL0_REG Registers
Table 17 . . . . AUX_SPI1_CNTL1_REG & AUX_SPI2_CNTL1_REG Registers
Table 18 . . . . AUX_SPI1_STAT_REG & AUX_SPI2_STAT_REG Registers
Table 19 . . . . AUX_SPI1_PEEK_REG & AUX_SPI2_PEEK_REG Registers
Table 20 . . . . AUX_SPI1_IO_REG & AUX_SPI2_IO_REG Registers
Table 21 . . . . AUX_SPI1_TXHOLD_REG & AUX_SPI2_TXHOLD_REG Registers
Table 22 . . . . I2C Address Map
Table 23 . . . . C Register
Table 24 . . . . S Register
Table 25 . . . . DLEN Register
Table 26 . . . . A Register
Table 27 . . . . FIFO Register
Table 28 . . . . DIV Register
Table 29 . . . . DEL Register
Table 30 . . . . CLKT Register
Table 31 . . . . DMA Controller Register Address Map
Table 32 . . . . DMA Control Block Definition
Table 33 . . . . DMA Lite Control Block Definition
Table 34 . . . . DMA4 Control Block Definition
Table 35 . . . . DMA Controller Register Map
Table 36 . . . . 0_CS, 1_CS, 2_CS, 3_CS, 4_CS, 5_CS, 6_CS, 7_CS, 8_CS, 9_CS & 10_CS Registers
Table 37 . . . . 0_CONBLK_AD, 1_CONBLK_AD, 2_CONBLK_AD, 3_CONBLK_AD, 4_CONBLK_AD,
5_CONBLK_AD, 6_CONBLK_AD, 7_CONBLK_AD, 8_CONBLK_AD, 9_CONBLK_AD & 10_CONBLK_AD
Registers
Table 38 . . . . 0_TI, 1_TI, 2_TI, 3_TI, 4_TI, 5_TI & 6_TI Registers
Table 39 . . . . 0_SOURCE_AD, 1_SOURCE_AD, 2_SOURCE_AD, 3_SOURCE_AD, 4_SOURCE_AD, 5_SOURCE_AD,
6_SOURCE_AD, 7_SOURCE_AD, 8_SOURCE_AD, 9_SOURCE_AD & 10_SOURCE_AD Registers
Table 40 . . . . 0_DEST_AD, 1_DEST_AD, 2_DEST_AD, 3_DEST_AD, 4_DEST_AD, 5_DEST_AD, 6_DEST_AD,
Chapter 1. Introduction
1.1. Overview
BCM2711 contains the following peripherals which may safely be accessed by the ARM:
• Timers
• Interrupt controller
• GPIO
• USB
• PCM / I2S
• DMA controller
• I2C masters
• SPI masters
• PWM
• UARTs
The purpose of this datasheet is to provide documentation for these peripherals in sufficient detail to
allow a developer to port an operating system to BCM2711. Not all of these peripherals have been fully
documented yet.
There are a number of peripherals which are intended to be controlled by the GPU. These are omitted
from this datasheet. Accessing these peripherals from the ARM is not recommended.
The BCM2711 has two main addressing schemes: a "Full" 35-bit address bus and a 32-bit "Legacy Master"
view as seen by the peripherals (except for "large address" masters). There’s also a "Low Peripherals"
mode which modifies the ARM’s view of the peripheral addresses. Figure 1 shows how these address
maps inter-relate. Note that the relative sizes of the address blocks in the diagram are definitely not to
scale! (The PCIe address range covers 8GB, but the Main peripherals address range only covers 64MB.)
0x7_FFFF_FFFF 0x7_FFFF_FFFF
PCIe PCIe
0x6_0000_0000 0x6_0000_0000
Reserved
0x5_0000_0000
Reserved
ARM Local
peripherals
0x4_C000_0000 0x4_C000_0000
L2 Cached L2 Cached
(non-allocating) (non-allocating)
0x4_8000_0000 0x4_8000_0000
Main peripherals
0x4_7C00_0000 Reserved
Reserved
0x4_4000_0000 0x4_4000_0000
L2 Cached L2 Cached
(allocating) (allocating)
0x4_0000_0000 0x4_0000_0000
SDRAM
(for the ARM)
0x1_0000_0000
0xFFFF_FFFF
SDRAM Paging ARM Local
(for the ARM) registers peripherals
0xC000_0000 SDRAM 0x0_FF80_0000
(for the ARM)
L2 Cached
Main peripherals
(non-allocating)
0x8000_0000 0x0_FC00_0000
SDRAM
Main peripherals
(for the ARM)
0x7c00_0000 0x0_4000_0000 0x0_4000_0000
SDRAM SDRAM
Reserved
(for the VC) Size of VC SDRAM (for the VC)
0x4000_0000 determined by
L2 Cached SDRAM config.txt SDRAM
(allocating) (for the ARM) (for the ARM)
0x0000_0000 0x0_0000_0000 0x0_0000_0000
Legacy Master view Full 35-bit Address Map ARM view of the Address Map
of Address Map in “Low Peripheral” mode
The full 35-bit address map is shown in Figure 1. This is seen by both "large address" masters (e.g. the
DMA4 engines) and the ARM CPU.
It has two L2 cache aliases (one allocating, one non-allocating) which cache (only) the first 1GB of
SDRAM.
• The ARM section of the RAM starts at 0x0_0000_0000 and extends up to the size of installed SDRAM.
• The VideoCore section of the RAM is mapped in from 0x0_4000_0000 downwards. The size of the
VideoCore RAM is determined by a setting in config.txt - refer to raspberrypi.org documentation for
further details.
The VideoCore maps the ARM physical address space directly to the bus address space seen by
[1]
VideoCore. The bus addresses for RAM are set up to map onto the uncached bus address range on the
VideoCore starting at 0x0_0000_0000.
When running in 32-bit mode, the ARM uses LPAE mode to enable it to access the full 32GB address
space.
Physical addresses range from 0x4_7C00_0000 to 0x4_7FFF_FFFF for Main peripherals, and from
0x4_C000_0000 to 0x4_FFFF_FFFF for ARM Local peripherals.
If the VPU enables "Low Peripheral" mode then the ARM (only) has Main peripherals available from
0x0_FC00_0000 to 0x0_FF7F_FFFF and ARM Local peripherals available from 0x0_FF80_0000 to
0x0_FFFF_FFFF.
The peripheral addresses specified in this document are legacy master addresses. Software
accessing peripherals using the DMA engines must use 32-bit legacy master addresses. The Main
peripherals are available from 0x7C00_0000 to 0x7FFF_FFFF. Behind the scenes, the VideoCore
transparently translates these addresses to the 35-bit 0x4_7nnn_nnnn addresses.
So a peripheral described in this document as being at legacy address 0x7Enn_nnnn is available in the
35-bit address space at 0x4_7Enn_nnnn, and visible to the ARM at 0x0_FEnn_nnnn if Low Peripheral
mode is enabled.
Software accessing RAM using the DMA engines must use legacy addresses (between 0xC000_0000 and
0xFFFF_FFFF). This accesses a 1GB window within the full 16GB SDRAM address space. If the DMA
engine needs to access RAM above the first 1GB, this window can be moved using the PAGE or PAGELITE
bits - see Chapter 4 for more details. Behind the scenes, the VideoCore transparently translates these
addresses to the 35-bit 0x0_nnnn_nnnn addresses.
Software accessing the VPU L2 cache using the DMA engines must use legacy addresses starting at
0x0000_0000 (for allocating cache) or 0x8000_0000 (for non-allocating cache). Behind the scenes, the
VideoCore transparently translates these addresses to the corresponding 35-bit 0x4_nnnn_nnnn
addresses. These 1GB windows can’t be moved, and are limited to the first 1GB of SDRAM.
Accesses to the same peripheral will always arrive and return in-order. It is only when switching from
one peripheral to another that data can arrive out-of-order. The simplest way to make sure that data is
processed in-order is to place a memory barrier instruction at critical positions in the code. You should
place:
It is not required to put a memory barrier instruction after each read or write access. Only at those
places in the code where it is possible that a peripheral read or write may be followed by a read or write
of a different peripheral. This is normally at the entry and exit points of the peripheral service code.
As interrupts can appear anywhere in the code, you should also safeguard those. If an interrupt routine
reads from a peripheral the routine should start with a memory read barrier. If an interrupt routine
writes to a peripheral the routine should end with a memory write barrier.
[1] BCM2711 provides a 1MB system L2 cache, which is used primarily by the GPU. Accesses to memory are routed either via or around
the L2 cache depending on the address range being used.
[2] Normally a processor assumes that if it executes two read operations the data will arrive in order. So a read from location X followed
by a read from location Y should return the data of location X first, followed by the data of location Y. Data arriving out of order can have
disastrous consequences. For example:
a_status = *pointer_to_peripheral_a;
b_status = *pointer_to_peripheral_b;
Without precautions the values ending up in the variables a_status and b_status can be swapped around.
It is theoretically possible for writes to go ‘wrong’ but that is far more difficult to achieve. The AXI system makes sure the data always
arrives in-order at its intended destination. So:
*pointer_to_peripheral_a = value_a;
*pointer_to_peripheral_b = value_b;
will always give the expected result. The only time write data can arrive out-of-order is if two different peripherals are connected to the
same external equipment.
There are two Auxiliary registers which control all three devices. One is the interrupt status register, the
second is the Auxiliary enable register. The Auxiliary IRQ status register can help to hierarchically
determine the source of an interrupt.
AUX_IRQ Register
Synopsis
The AUX_IRQ register is used to check any pending interrupts which may be asserted by the three
Auxiliary sub blocks.
0 Mini UART IRQ If set the mini UART has an interrupt pending. RO 0
AUX_ENABLES Register
Synopsis
The AUX_ENABLES register is used to enable the three modules: UART1, SPI1, SPI2.
0 Mini UART If set the mini UART is enabled. The UART will RW 0
enable immediately start receiving data, especially if the
UART1_RX line is low.
If clear the mini UART is disabled. That also disables
any mini UART register access
If the enable bits are clear you will have no access to a peripheral. You can not even read or write the
registers!
GPIO pins should be set up first before enabling the UART. The UART core is built to emulate 16550
behaviour. So when it is enabled any data at the inputs will immediately be received. If the UART1_RX
line is low (because the GPIO pins have not been set-up yet) that will be seen as a start bit and the UART
will start receiving 0x00-characters.
Valid stops bits are not required for the UART. (See also Implementation details). Hence any bit status is
acceptable as a stop bit, and is only used so there is a clean timing start for the next bit.
Immediately after a reset, the baudrate register will be zero and the system clock will be 250 MHz. So
only 2.5 μseconds suffice to fill the receive FIFO. The result will be that if the UART is enabled without
changing the default configuration, the FIFO will be full and overflowing in no time flat.
• No parities
• Break generation
This is a mini UART and it does NOT have the following capabilities:
• Break detection
• Parity bit
The implemented UART is not a 16650 compatible UART. However as far as possible the first 8 control
and status registers are laid out like a 16550 UART. All 16550 register bits which are not supported can
be written but will be ignored and read back as 0. All control bits for simple UART receive/transmit
operations are available.
The UART1_CTS and UART1_RX inputs are synchronised and will take 2 system clock cycles before they
are processed.
The module does not check for any framing errors. After receiving a start bit and 8 (or 7) data bits the
receiver waits for one half-bit time and then starts scanning for the next start bit. The mini UART does
not check if the stop bit is high or wait for the stop bit to appear. As a result of this, a UART1_RX input
line which is continuously low (a break condition or an error in connection or GPIO setup) causes the
receiver to continuously receive 0x00 symbols.
The mini UART uses 8-times oversampling. The Baudrate can be calculated from:
If the system clock is 250 MHz and the baud register is zero the baudrate is 31.25 Mega baud. (25
Mbits/sec or 3.125 Mbytes/sec). The lowest baudrate with a 250 MHz system clock is 476 Baud.
When writing to the data register only the LS 8 bits are taken. All other bits are ignored.
When reading from the data register only the LS 8 bits are valid. All other bits are zero.
AUX_MU_IO_REG Register
Synopsis
The AUX_MU_IO_REG register is primarily used to write data to and read data from the UART FIFOs.
If the DLAB bit in the line control register is set this register gives access to the LS 8 bits of the baud
rate. (Note: there is easier access to the baud rate register in AUX_MU_BAUD_REG)
7:0 Transmit data Data written is put in the transmit FIFO (Provided it is WO 0
write, DLAB=0 not full)
(Only if bit 7 of the line control register (DLAB bit) is
clear)
7:0 Receive data Data read is taken from the receive FIFO (Provided it is RO 0
read, DLAB=0 not empty)
(Only if bit 7 of the line control register (DLAB bit) is
clear)
AUX_MU_IER_REG Register
Synopsis
The AUX_MU_IER_REG register is primarily used to enable interrupts
If the DLAB bit in the line control register is set this register gives access to the MS 8 bits of the baud
rate. (Note: there is easier access to the baud rate register in AUX_MU_BAUD_REG)
1 Enable receive If this bit is set the interrupt line is asserted whenever RW 0
interrupt the receive FIFO holds at least 1 byte.
(DLAB=0) If this bit is clear no receive interrupts are generated.
0 Enable transmit If this bit is set the interrupt line is asserted whenever RW 0
interrupt the transmit FIFO is empty.
(DLAB=0) If this bit is clear no transmit interrupts are generated.
AUX_MU_IIR_REG Register
Synopsis
The AUX_MU_IIR_REG register shows the interrupt status.
It also has two FIFO enable status bits and (when writing) FIFO clear bits.
7:6 FIFO enables Both bits always read as 1 as the FIFOs are always RO 11
enabled
AUX_MU_LCR_REG Register
Synopsis
The AUX_MU_LCR_REG register controls the line data format and gives access to the baudrate register
7 DLAB access If set the first two Mini UART registers give access to the RW 0
Baudrate register. During operation this bit must be
cleared.
AUX_MU_MCR_REG Register
Synopsis
The AUX_MU_MCR_REG register controls the 'modem' signals.
AUX_MU_LSR_REG Register
Synopsis
The AUX_MU_LSR_REG register shows the data status.
6 Transmitter idle This bit is set if the transmit FIFO is empty and the RO 1
transmitter is idle. (Finished shifting out the last bit).
5 Transmitter This bit is set if the transmit FIFO can accept at least RO 0
empty one byte.
1 Receiver Overrun This bit is set if there was a receiver overrun. That is: RC 0
one or more characters arrived whilst the receive FIFO
was full. The newly arrived characters have been
discarded. This bit is cleared each time this register is
read. To do a non-destructive read of this overrun bit
use the Mini UART Extra Status register.
0 Data ready This bit is set if the receive FIFO holds at least 1 symbol. RO 0
AUX_MU_MSR_REG Register
Synopsis
The AUX_MU_MSR_REG register shows the 'modem' status.
4 CTS status This bit is the inverse of the UART1_CTS input. Thus: RO 1
If set the UART1_CTS pin is low
If clear the UART1_CTS pin is high
AUX_MU_SCRATCH Register
Synopsis
The AUX_MU_SCRATCH is a single byte of temporary storage.
AUX_MU_CNTL_REG Register
Synopsis
The AUX_MU_CNTL_REG provides access to some extra useful and nice features not found on a
normal 16550 UART.
7 CTS assert level This bit allows one to invert the CTS auto flow RW 0
operation polarity.
If set the CTS auto flow assert level is low*
If clear the CTS auto flow assert level is high*
6 RTS assert level This bit allows one to invert the RTS auto flow RW 0
operation polarity.
If set the RTS auto flow assert level is low*
If clear the RTS auto flow assert level is high*
5:4 RTS AUTO flow These two bits specify at what receiver FIFO level the RW 0
level RTS line is de-asserted in auto-flow mode.
00 : De-assert RTS when the receive FIFO has 3 empty
spaces left.
01 : De-assert RTS when the receive FIFO has 2 empty
spaces left.
10 : De-assert RTS when the receive FIFO has 1 empty
space left.
11 : De-assert RTS when the receive FIFO has 4 empty
spaces left.
3 Enable transmit If this bit is set the transmitter will stop if the CTS line is RW 0
Auto flow-control de-asserted.
using CTS If this bit is clear the transmitter will ignore the status
of the CTS line
2 Enable receive If this bit is set the RTS line will de-assert if the receive RW 0
Auto flow-control FIFO reaches its 'auto flow' level. In fact the RTS line
using RTS will behave as an RTR (Ready To Receive) line.
If this bit is clear the RTS line is controlled by the
AUX_MU_MCR_REG register bit 1.
0 Receiver enable If this bit is set the mini UART receiver is enabled. RW 1
If this bit is clear the mini UART receiver is disabled
Receiver enable
If this bit is clear no new symbols will be accepted by the receiver. Any symbols in progress of
reception will be finished.
Transmitter enable
If this bit is clear no new symbols will be sent by the transmitter. Any symbols in progress of
transmission will be finished.
CTS auto flow control impacts the transmitter only. The transmitter will not send out new symbols when
the CTS line is de-asserted. Any symbols in progress of transmission when the CTS line becomes de-
asserted will be finished.
RTS auto flow control impacts the receiver only. In fact the name RTS for the control line is incorrect and
should be RTR (Ready to Receive). The receiver will de-assert the RTS (RTR) line when its receive FIFO
has a number of empty spaces left. Normally 3 empty spaces should be enough.
If looping back a mini UART using full auto flow control the logic is fast enough to allow the RTS auto
flow level of '10' (De-assert RTS when the receive FIFO has 1 empty space left).
AUX_MU_STAT_REG Register
Synopsis
The AUX_MU_STAT_REG provides a lot of useful information about the internal status of the mini
UART not found on a normal 16550 UART.
27:24 Transmit FIFO fill These bits shows how many symbols are stored in the RO 0
level transmit FIFO
The value is in the range 0-8
19:16 Receive FIFO fill These bits shows how many symbols are stored in the RO 0
level receive FIFO
The value is in the range 0-8
9 Transmitter done This bit is set if the transmitter is idle and the transmit RO 1
FIFO is empty.
It is a logic AND of bits 3 and 8
8 Transmit FIFO is If this bit is set the transmitter FIFO is empty. Thus it RO 1
empty can accept 8 symbols.
7 CTS line This bit shows the status of the UART1_CTS line. RO 0
6 RTS status This bit shows the status of the UART1_RTS line. RO 0
4 Receiver overrun This bit is set if there was a receiver overrun. That is: RO 0
one or more characters arrived whilst the receive FIFO
was full. The newly arrived characters have been
discarded. This bit is cleared each time the
AUX_MU_LSR_REG register is read.
1 Space available If this bit is set the mini UART transmitter FIFO can RO 0
accept at least one more symbol.
If this bit is clear the mini UART transmitter FIFO is full
0 Symbol available If this bit is set the mini UART receive FIFO contains at RO 0
least 1 symbol
If this bit is clear the mini UART receiver FIFO is empty
Receiver is idle
This bit is only useful if the receiver is disabled. The normal use is to disable the receiver, then check
(or wait) until the bit is set. Now you can be sure that no new symbols will arrive (e.g. now you can
change the baudrate…).
Transmitter is idle
This bit tells if the transmitter is idle. Note that the bit will set only for a short time if the transmit
FIFO contains data. Normally you want to use bit 9: Transmitter done.
RTS status
This bit is useful only in receive Auto flow-control mode as it shows the status of the RTS line.
AUX_MU_BAUD_REG Register
Synopsis
The AUX_MU_BAUD_REG register allows direct access to the 16-bit wide baudrate counter.
This is the same register as is accessed using the DLAB bit and the first two registers, but much easier to
access.
A major issue with an SPI interface is that there is no SPI standard in any form. Because the SPI interface
has been around for a long time some pseudo-standard rules have appeared mostly when interfacing
with memory devices. The universal SPI master has been developed to work even with the most 'non-
standard' SPI devices.
The following diagrams shows a typical SPI access cycle. In this case we have 8 SPI clocks.
One bit-time before any clock edge changes the CS_n will go low. This makes sure that the MOSI signal
has a full bit-time of set-up against any changing clock edges.
The operation normally ends after the last clock cycle. Note that at the end there is one half-bit time
where the clock does not change but which still is part of the operation cycle.
There is an option to add a half-bit cycle hold time. This makes sure that any MISO data has at least a full
SPI bit-time to arrive. (Without this hold time, data clocked out of the SPI device on the last clock edge
would have only half a bit-time to arrive).
Lastly there is a guarantee of at least a full bit-time where the SPI chip select is high. A longer CS_n high
period can be programmed for another 1-7 cycles.
If the system clock is 250 MHz and the speed field is zero the SPI clock frequency is 125 MHz. The
practical SPI clock will be lower as the I/O pads can not transmit or receive signals at such high speed.
The lowest SPI clock frequency with a 250 MHz system clock is 30.5 KHz.
The hardware has an option to add hold time to the MOSI signal against the SPI clk. This is again done
using the system clock. So a 250 MHz system clock will add hold times in units of 4 ns. Hold times of 0, 1,
4 and 7 system clock cycles can be used. (So at 250MHz an additional hold time of 0, 4, 16 and 28 ns can
be achieved). The hold time is additional to the normal output timing as specified in the data sheet.
2.3.2. Interrupts
The SPI block has two interrupts: TX FIFO is empty, SPI is Idle.
TX FIFO is empty
This interrupt will be asserted as soon as the last entry has been read from the transmit FIFO. At that
time the interface will still be busy shifting out that data. This also implies that the receive FIFO will
not yet contain the last received data. It is possible at that time to fill the TX FIFO again and read the
receive FIFO entries which have been received. There is a RX FIFO level field which tells you exactly
how many words are in the receive FIFO. In general at that time the receive FIFO should contain the
number of TX items minus one (the last one still being received). Note that there is no "receive FIFO
full" interrupt as the number of entries received can never be more than the number of entries
transmitted.
SPI is Idle
This interrupt will be asserted when the transmit FIFO is empty and the SPI block has finished all
actions (including the CS-high time). By this time the receive FIFO will have received all data as well.
The SPI module works in bursts of up to 32 bits. Some SPI devices require data which is longer than 32
bits. To do this the user must make use of the two different data TX addresses: TX data written to one
address causes the CS to remain asserted. TX data written to the other address causes the CS to be de-
asserted at the end of the transmit cycle. So in order to exchange 96 bits you do the following:
Write the first two data words to one address, then write the third word to the other address.
Synopsis
The AUX_SPIx_CNTL0_REG registers control many features of the SPI interfaces.
19:17 Chip Selects The pattern output on the CS pins when active. RW 111
15 Variable CS If 1 the SPI takes the CS pattern and the data from the RW 0
TX FIFO
If 0 the SPI takes the CS pattern from bits 17-19 of this
register
Set this bit only if bit 14 (variable width) is also set
14 Variable width If 1 the SPI takes the shift length and the data from the RW 0
TX FIFO
If 0 the SPI takes the shift length from bits 0-5 of this
register
13:12 DOUT Hold time Controls the extra DOUT hold time in system clock RW 0
cycles.
00 : No extra hold time
01 : 1 system clock extra hold time
10 : 4 system clocks extra hold time
11 : 7 system clocks extra hold time
11 Enable Enables the SPI interface. Whilst disabled the FIFOs can RW 0
still be written to or read from
This bit should be 1 during normal operation.
9 Clear FIFOs If 1 the receive and transmit FIFOs are held in reset RW 0
(and thus flushed.)
This bit should be 0 during normal operation.
8 Out rising If 1 data is clocked out on the rising edge of the SPI RW 0
clock
If 0 data is clocked out on the falling edge of the SPI
clock
6 Shift out MS bit If 1 the data is shifted out starting with the MS bit. (bit RW 0
first 31 or bit 23)
If 0 the data is shifted out starting with the LS bit. (bit 0)
Variable width
In this mode the shift length is taken from the transmit FIFO. The transmit data bits 28:24 are used as
shift length and the data bits 23:0 are the actual transmit data. If the option 'shift MS out first' is
selected the first bit shifted out will be bit 23. The receive data will arrive as normal.
Variable CS
This mode is used together with the variable width mode. In this mode the CS pattern is taken from
the transmit FIFO. The transmit data bits 31:29 are used as CS and the data bits 23:0 are the actual
transmit data. This allows the CPU to write to different SPI devices without having to change the CS
bits. However the data length is limited to 24 bits.
Post-input mode
Some rare SPI devices output data on the falling clock edge which then has to be picked up on the
next falling clock edge. There are two problems with this:
1. On the very first falling clock edge there is no valid data arriving
2. After the last clock edge there is one more 'dangling' bit to pick up
The post-input mode is specifically to deal with this sort of data. If the post-input mode bit is set, the data
arriving at the first falling clock edge is ignored. Then after the last falling clock edge the CS remains
asserted and after a full bit-time the last data bit is picked up. The following figure shows this behaviour:
In this mode the CS will go high 1 full SPI clock cycle after the last clock edge. This guarantees a full SPI
clock cycle time for the data to settle and arrive at the MISO input.
Synopsis
The AUX_SPIx_CNTL1_REG registers control more features of the SPI interfaces.
10:8 CS high time Additional SPI clock cycles where the CS is high. RW 0
7 TX empty IRQ If 1 the interrupt line is high when the transmit FIFO is RW 0
empty
6 Done IRQ If 1 the interrupt line is high when the interface is idle RW 0
1 Shift in MS bit If 1 the data is shifted in starting with the MS bit. (bit RW 0
first 15)
If 0 the data is shifted in starting with the LS bit. (bit 0)
0 Keep input If 1 the receiver shift register is NOT cleared. Thus new RW 0
data is concatenated to old data.
If 0 the receiver shift register is cleared before each
transaction.
Keep input
Setting the 'Keep input' bit will prevent the input shift register being cleared between transactions.
However the contents of the shift register is still written to the receive FIFO at the end of each
transaction. E.g. if you receive two 8-bit values 0x81 followed by 0x46 the receive FIFO will contain:
0x0081 in the first entry and 0x8146 in the second entry. This mode may save CPU time concatenating
bits (4 bits followed by 12 bits).
CS high time
The SPI CS will always be high for at least 1 SPI clock cycle. Some SPI devices need more time to
process the data. This field will set a longer CS-high time. So the actual CS high time is (CS_high_time +
1) (in SPI clock cycles).
Synopsis
The AUX_SPIx_STAT_REG registers show the status of the SPI interfaces.
27:24 TX FIFO level The number of data units in the transmit data FIFO RO 0
19:16 RX FIFO level The number of data units in the receive data FIFO. RO 0
5:0 Bit count The number of bits still to be processed. Starts with RO 0
'shift-length' and counts down.
Busy
This status bit indicates if the module is busy. It will be clear when the TX FIFO is empty and the
module has finished all activities, including waiting the minimum CS high time.
Synopsis
The AUX_SPIx_PEEK_REG registers show received data of the SPI interfaces.
15:0 Data Reads from this address will show the top entry from RO 0
the receive FIFO, but the data is not taken from the
FIFO. This provides a means of inspecting the data but
not removing it from the FIFO.
Synopsis
The AUX_SPIx_IO_REG registers are the primary data port of the SPI interfaces.
These four addresses all write to the same FIFO.
Writing to any of these addresses causes the SPI CS_n pins to be de-asserted at the end of the
access.
Synopsis
The AUX_SPIx_TXHOLD_REG registers are the extended CS port of the SPI interfaces.
These four addresses all write to the same FIFO.
Writing to these addresses causes the SPI CS_n pins to remain asserted at the end of the access.
[3] The UART itself has no throughput limitations, in fact it can run up to 32 Mega baud. But doing so requires significant CPU
involvement as it has shallow FIFOs and no DMA support.
[4] Again the SPIs themselves have no throughput limitations, in fact they can run with an SPI clock of 125 MHz. But doing so requires
significant CPU involvement as they have shallow FIFOs and no DMA support.
Chapter 3. BSC
3.1. Overview
The Broadcom Serial Control (BSC) controller is a master, fast-mode (400Kb/s) BSC controller. The
2
Broadcom Serial Control bus is a proprietary bus compliant with the Philips® I C bus/interface version
2.1 January 2000.
2
• I C single master only operation (supports clock stretching wait states)
• The BSC controller in the BCM2711 fixes the clock-strectching bug that was present in BCM283x
devices
There are eight BSC masters inside BCM2711. The user-accessible register addresses start from
• BSC0: 0x7E20 5000
• BSC1: 0x7E80 4000
• BSC3: 0x7E20 5600
• BSC4: 0x7E20 5800
• BSC5: 0x7E20 5A80
• BSC6: 0x7E20 5C00
2
The table below shows the addresses of the I C registers, where the address is an offset from one of the
base addresses listed above.
0x00 C Control 32
0x04 S Status 32
C Register
Synopsis
The control register is used to enable interrupts, clear the FIFO, define a read or write operation and
start a transfer.
The READ field specifies the type of transfer.
The CLEAR field is used to clear the FIFO. Writing to this field is a one-shot operation which will
always read back as zero. The CLEAR bit can set at the same time as the start transfer bit, and will
result in the FIFO being cleared just prior to the start of transfer. Note that clearing the FIFO during a
transfer will result in the transfer being aborted.
The ST field starts a new BSC transfer. This is a one-shot action, and so the bit will always read back
as 0.
The INTD field enables interrupts at the end of a transfer - the DONE condition. The interrupt
remains active until the DONE condition is cleared by writing a 1 to the I2CS.DONE field. Writing a 0
to the INTD field disables interrupts on DONE.
The INTT field enables interrupts whenever the FIFO is ¼ or more empty and needs writing (i.e.
during a write transfer) - the TXW condition. The interrupt remains active until the TXW condition is
cleared by writing sufficient data to the FIFO to complete the transfer. Writing a 0 to the INTT field
disables interrupts on TXW.
The INTR field enables interrupts whenever the FIFO is ¾ or more full and needs reading (i.e. during
a read transfer) - the RXR condition. The interrupt remains active until the RXW condition is cleared
by reading sufficient data from the FIFO. Writing a 0 to the INTR field disables interrupts on RXR.
The I2CEN field enables BSC operations. If this bit is 0 then transfers will not be performed. All
register accesses are still permitted however.
S Register
Synopsis
The status register is used to record activity status, errors and interrupt requests.
The TA field indicates the activity status of the BSC controller. This read-only field returns a 1 when
the controller is in the middle of a transfer and a 0 when idle.
The DONE field is set when the transfer completes. The DONE condition can be used with I2CC.INTD
to generate an interrupt on transfer completion. The DONE field is reset by writing a 1, writing a 0 to
the field has no effect.
The read-only TXW bit is set during a write transfer and the FIFO is less than ¼ full and needs
writing. Writing sufficient data (i.e. enough data to either fill the FIFO more than ¼ full or complete
the transfer) to the FIFO will clear the field. When the I2CC.INTT control bit is set, the TXW condition
can be used to generate an interrupt to write more data to the FIFO to complete the current transfer.
If the I2C controller runs out of data to send, it will wait for more data to be written into the FIFO.
The read-only RXR field is set during a read transfer and the FIFO is ¾ or more full and needs
reading. Reading sufficient data to bring the depth below ¾ will clear the field.
When I2CC.INTR control bit is set, the RXR condition can be used to generate an interrupt to read data
from the FIFO before it becomes full. In the event that the FIFO does become full, all I2C operations
will stall until data is removed from the FIFO.
The read-only TXD field is set when the FIFO has space for at least one byte of data.
TXD is clear when the FIFO is full. The TXD field can be used to check that the FIFO can accept data
before any is written. Any writes to a full TX FIFO will be ignored.
The read-only RXD field is set when the FIFO contains at least one byte of data. RXD is cleared when
the FIFO becomes empty. The RXD field can be used to check that the FIFO contains data before
reading. Reading from an empty FIFO will return invalid data.
The read-only TXE field is set when the FIFO is empty. No further data will be transmitted until more
data is written to the FIFO.
The read-only RXF field is set when the FIFO is full. No more clocks will be generated until space is
available in the FIFO to receive more data.
The ERR field is set when the slave fails to acknowledge either its address or a data byte written to it.
The ERR field is reset by writing a 1, writing a 0 to the field has no effect.
The CLKT field is set when the slave holds the SCL signal high for too long (clock stretching). The
CLKT field is reset by writing a 1, writing a 0 to the field has no effect.
DLEN Register
Synopsis
The data length register defines the number of bytes of data to transmit or receive in the I2C transfer.
Reading the register gives the number of bytes remaining in the current transfer.
The DLEN field specifies the number of bytes to be transmitted/received. Reading the DLEN field
when a transfer is in progress (TA = 1) returns the number of bytes still to be transmitted or received.
Reading the DLEN field when the transfer has just completed (DONE = 1) returns zero as there are no
more bytes to transmit or receive.
Finally, reading the DLEN field when TA = 0 and DONE = 0 returns the last value written. The DLEN
field can be left over multiple transfers.
A Register
Synopsis
The slave address register specifies the slave address and cycle type. The address register can be left
across multiple transfers.
The ADDR field specifies the slave address of the I2C device.
FIFO Register
Synopsis
The Data FIFO register is used to access the FIFO. Write cycles to this address place data in the 16-byte
FIFO, ready to transmit on the BSC bus. Read cycles access data received from the bus.
Data writes to a full FIFO will be ignored and data reads from an empty FIFO will result in invalid
data. The FIFO can be cleared using the I2CC.CLEAR field.
The DATA field specifies the data to be transmitted or received.
7:0 DATA Writes to the register write transmit data to the FIFO. RW 0x0
Reads from register read received data from the FIFO.
DIV Register
Synopsis
The clock divider register is used to define the clock speed of the BSC peripheral.
The CDIV field specifies the core clock divider used by the BSC.
DEL Register
Synopsis
The data delay register provides fine control over the sampling/launch point of the data.
The REDL field specifies the number core clocks to wait after the rising edge before sampling the
incoming data.
The FEDL field specifies the number core clocks to wait after the falling edge before outputting the
next data bit.
Note: Care must be taken in choosing values for FEDL and REDL as it is possible to cause the BSC
master to malfunction by setting values of CDIV/2 or greater. Therefore the delay values should
always be set to less than CDIV/2.
CLKT Register
Synopsis
The clock stretch timeout register provides a timeout on how long the master waits for the slave to
stretch the clock before deciding that the slave has hung.
The TOUT field specifies the number I2C SCL clocks to wait after releasing SCL high and finding that
the SCL is still low before deciding that the slave is not responding and moving the I2C machine
forward. When a timeout occurs, the I2CS.CLKT bit is set.
Writing 0x0 to TOUT will result in the Clock Stretch Timeout being disabled.
10-bit addressing is compatible with, and can be combined with, 7-bit addressing. Using 10 bits for
addressing exploits the reserved combination 1111 0xx for the first byte following a START (S) or
The 10-bit slave address is formed from the first two bytes following a S or Sr condition.
The first seven bits of the first byte are the combination 11110XX of which the last two bits (XX) are the
two most significant bits of the 10-bit address. The eighth bit of the first byte is the R/W bit. If the R/W bit
is ‘0’ (write) then the following byte contains the remaining 8 bits of the 10-bit address. If the R/W bit is
‘1’ then the next byte contains data transmitted from the slave to the master.
3.3.1. Writing
Figure 2 shows a write to a slave with a 10-bit address, to perform this using the controller one must do
the following:
1. Write the number of data bytes to written (plus one) to the I2CDLEN register
2. Write ‘XXXXXXXX’ to the FIFO where ‘XXXXXXXX’ are the least 8 significant bits of the 10-bit slave
address
4. Write ‘11110XX’ to Slave Address Register where ‘XX’ are the two most significant bits of the 10-bit
address
3.3.2. Reading
Figure 3 shows how a read from a slave with a 10-bit address is performed. The following procedure
2. Write ‘XXXXXXXX’ to the FIFO where ‘XXXXXXXX’ are the least 8 significant bits of the 10-bit slave
address
3. Write ‘11110XX’ to the Slave Address Register where ‘XX’ are the two most significant bits of the 10-
bit address
7. Set I2CC.READ = 1 and I2CC.ST = 1, this will send the repeat start bit, the slave address and the R/W
bit (which is ‘1’), initiating the read
Note that the DMA controller is directly connected to the peripherals. Therefore the DMA controller
must be set-up to use the Legacy Master addresses of the peripherals.
The BCM2711 DMA Controller provides a total of 16 DMA channels. Four of these are DMA Lite channels
(with reduced performance and features), and four of them are DMA4 channels (with increased
performance and a wider address range). Each channel operates independently from the others and is
internally arbitrated onto one of the three system busses. This means that the amount of bandwidth that
a DMA channel may consume can be controlled by the arbiter settings (although these are not publicly
exposed).
Each DMA channel operates by loading a Control Block (CB) data structure from memory into internal
registers. The Control Block defines the required DMA operation. Each Control Block can point to a
further Control Block to be loaded and executed once the operation described in the current Control
Block has completed. In this way a linked list of Control Blocks can be constructed in order to execute a
sequence of DMA operations without software intervention.
The DMA supports AXI read bursts to ensure efficient external SDRAM use. The DMA Control Block
contains a burst parameter which indicates the required burst size of certain memory transfers. In
general the DMA doesn’t do write bursts, although wide writes will be done in 2 beat bursts if possible.
Memory-to-Peripheral transfers can be paced by a Data Request (DREQ) signal which is generated by the
peripheral. The DREQ signal is level sensitive and controls the DMA by gating its AXI bus requests.
A peripheral can also provide a Panic signal alongside the DREQ to indicate that there is an imminent
danger of FIFO underflow or overflow or similar critical situation. The Panic is used to select the AXI
apriority level which is then passed out onto the AXI bus so that it can be used to influence arbitration in
the rest of the system.
The DMA can deal with byte aligned transfers and will minimise bus traffic by buffering and packing
misaligned accesses.
Each DMA channel can be fully disabled via a top level power register to save power.
DMA Channel 15 however, is physically removed from the other DMA Channels and so has a different
address base of 0x7EE0 5000. DMA Channel 15 is exclusively used by the VPU.
Each DMA channel of a particular type has an identical register map, only the base address of each
channel is different.
There is a global enable register at the top of the Address map that can disable each DMA for
powersaving.
Only three registers in each channel’s register set are directly writeable (CS, CONBLK_AD and DEBUG).
The other registers (TI, SOURCE_AD, DEST_AD, TXFR_LEN, STRIDE & NEXTCONBK) are automatically
loaded from a Control Block data structure held in external memory.
Control Blocks (CB) are 8 words (256 bits) in length and must start at a 256-bit aligned address. The
format of the different CB data structures in memory, are shown below.
Each 32-bit word of the Control Block is automatically loaded into the corresponding 32-bit DMA Control
Block register at the start of a DMA transfer. The descriptions of these registers also define the
corresponding bit locations in the CB data structure in memory.
0 Transfer Information TI
0 Transfer Information TI
0 Transfer Information TI
[5]
The DMA is started by writing the address of a CB structure into the CONBLK_AD register and then
setting the ACTIVE bit. The DMA will fetch the CB from the address set in the SCB_ADDR field of the
[6]
CONBLK_AD register and it will load it into the read-only registers described below. It will then begin a
DMA transfer according to the information in the CB.
When it has completed the current DMA transfer (length ⇒ 0) the DMA will update the CONBLK_AD
[7]
register with the contents of the NEXTCONBK register , fetch a new CB from that address, and start the
whole procedure once again.
The DMA will stop (and clear the ACTIVE bit) when it has completed a DMA transfer and the
NEXTCONBK register is set to 0x0000_0000. It will load this value into the CONBLK_AD register and then
stop.
Most of the Control Block registers cannot be written to directly as they are loaded automatically from
memory. They can be read to provide status information, and to indicate the progress of the current
DMA transfer. The value loaded into the NEXTCONBK / NEXT_CB register can be overwritten so that the
linked list of Control Block data structures can be dynamically altered. However it is only safe to do this
when the DMA is paused.
Register Map
0_CS, 1_CS, 2_CS, 3_CS, 4_CS, 5_CS, 6_CS, 7_CS, 8_CS, 9_CS & 10_CS Registers
Synopsis
DMA Control and Status register contains the main control and status bits for this DMA channel.
Table 36. 0_CS, 1_CS, 2_CS, 3_CS, 4_CS, 5_CS, 6_CS, 7_CS, 8_CS, 9_CS & 10_CS Registers
Synopsis
DMA Control Block Address register.
Synopsis
DMA Transfer Information.
Table 38. 0_TI, 1_TI, 2_TI, 3_TI, 4_TI, 5_TI & 6_TI Registers
Synopsis
DMA Source Address
Synopsis
DMA Destination Address
Table 40. 0_DEST_AD, 1_DEST_AD, 2_DEST_AD, 3_DEST_AD, 4_DEST_AD, 5_DEST_AD, 6_DEST_AD, 7_DEST_AD,
8_DEST_AD, 9_DEST_AD & 10_DEST_AD Registers
Synopsis
DMA Transfer Length. This specifies the amount of data to be transferred in bytes.
In normal (non 2D) mode this specifies the amount of bytes to be transferred.
In 2D mode it is interpreted as an X and a Y length, and the DMA will perform Y transfers, each of
length X bytes and add the strides onto the addresses after each X leg of the transfer.
The length register is updated by the DMA engine as the transfer progresses, so it will indicate the
data left to transfer.
Table 41. 0_TXFR_LEN, 1_TXFR_LEN, 2_TXFR_LEN, 3_TXFR_LEN, 4_TXFR_LEN, 5_TXFR_LEN & 6_TXFR_LEN
Registers
Synopsis
DMA 2D Stride
Table 42. 0_STRIDE, 1_STRIDE, 2_STRIDE, 3_STRIDE, 4_STRIDE, 5_STRIDE & 6_STRIDE Registers
Synopsis
DMA Next Control Block Address
The value loaded into this register can be overwritten so that the linked list of Control Block data
structures can be altered. However it is only safe to do this when the DMA is paused. The address
must be 256-bit aligned and so the bottom 5 bits cannot be set and will read back as zero.
Synopsis
DMA Debug register.
Table 44. 0_DEBUG, 1_DEBUG, 2_DEBUG, 3_DEBUG, 4_DEBUG, 5_DEBUG & 6_DEBUG Registers
Synopsis
DMA Lite Transfer Information.
Synopsis
DMA Lite Transfer Length
Synopsis
DMA Lite Debug register.
Synopsis
DMA4 Control and Status register contains the main control and status bits for this DMA4 channel.
31 HALT Writing a 1 to this bit will cleanly halt the current DMA W1SC 0x0
transfer. The halt will cause the DMA4 to zero its length
counters and thus it will complete the current transfer
and wait until all outstanding bus activity has finished.
The DMA4 will then zero the active flag and return to
idle, leaving the address of the aborted CB in the CB reg.
The halt bit will self clear when the DMA4 has fully
stopped.
The Halt bit can be automatically set if the DMA4
detects an error and the debug HALT_ON_ERROR bit is
set.
7 WAITING_FOR_O The DMA4 is Waiting for all the Write Response to be RO 0x0
UTSTANDING_W returned.
RITES If WAIT_FOR_OUTSTANDING_WRITES is enabled, the
DMA4 will complete its transfer and then enter a
waiting state where it waits for all the outstanding
write responses to be returned. When they are all
accounted for, the DMA4 will indicate that the transfer
is complete and set the END or INT flags and move on to
the next CB.
1 = The DMA4 is waiting for outstanding bresponses.
Synopsis
DMA4 Control Block Address register.
Synopsis
DMA4 Debug register.
27:24 ID ID RO 0x0
Returns the ID of this DMA4. This is also used as the AXI
subid
3 READ_CB_ERROR Slave Read Response Error During Control Block Read RC 0x0
Set if the read operation returned an error value on the
read response bus whilst reading the CB.
It is cleared by reading.
Synopsis
DMA4 Transfer Information.
Synopsis
Lower 32 bits of the DMA4 Source Address
The DMA4 can handle up to 40bit addresses so the full source address is split over 2 registers.
Synopsis
DMA4 Source Information
This contains the high bits of the source address[40:32] as well as other source control bits
Synopsis
Lower 32 bits of the DMA4 Destination Address
The DMA4 can handle up to 40bit addresses so the full address is split over 2 registers.
Synopsis
DMA4 Destination Information
This contains the high bits of the destination address [40:32] and other information bits for the
destination
Synopsis
DMA4 Transfer Length.
Synopsis
DMA4 Next Control Block Address
When the current DMA transfer has completed, the Next Control Block address is transferred to the
CB address register and if the active bit is still set the next DMA in the linked list of CBs is begun.
A CB with a Next Control Block Address of 0 indicates the end of the list. Once that CB is executed the
zero next CB will be loaded and the DMA will stop (as the start condition for the DMA4 is (ACTIVE &
CB!=0).
The value loaded into this register can be overwritten so that the linked list of Control Block data
structures can be dynamically altered. However it is only safe to do this when the DMA4 is paused.
The address must be 256-bit aligned and so the bottom 5 bits of the byte address are discarded, i.e.
write cb_byte_address[39:0]>>5 into the CB.
Synopsis
DMA4 Debug2 register.
INT_STATUS Register
Synopsis
Interrupt status of each DMA engine
ENABLE Register
Synopsis
Global enable bits for each channel.
Setting these to 0 will disable the DMA for power saving reasons. Disabling whilst the DMA is
operating will be fatal.
31:28 PAGELITE Set the 1G SDRAM ram page that the DMA Lite engines RW 0x0
(DMA7-10) will access when addressing the 1G
uncached range C000_0000→ffff_ffff
E.g. setting this to 1 will mean that when the DMA
writes to C000_0000 (uncached) the final address in
SDRAM will be 4000_0000 ( pagelite<<30 | addr[29:0] )
This allows the 1G uncached page to be moved around
the 16G SDRAM space
27:24 PAGE Set the 1G SDRAM ram page that the 30-bit DMA RW 0x0
engines (DMA0-6) will access when addressing the 1G
uncached range C000_0000→ffff_ffff
E.g. setting this to 1 will mean that when the DMA
writes to C000_0000 (uncached) the final address in
SDRAM will be 4000_0000 ( page<<30 | addr[29:0] )
This allows the 1G uncached page to be moved around
the 16G SDRAM space
A DREQ (Data Request) mechanism is used to pace the data flow between the DMA and a peripheral.
Each peripheral is allocated a permanent DREQ signal. Each DMA channel can select which of the DREQ
signals should be used to pace the transfer by controlling the DMA reads, DMA writes or both. Note that
DREQ 0 is permanently enabled and can be used if no DREQ is required.
When a DREQ signal is being used to pace the DMA reads, the DMA will wait until it has sampled DREQ
high before launching a single or burst read operation. It will then wait for all the read data to be
returned before re-checking the DREQ and starting the next read. Thus once a peripheral receives the
read request it should remove its DREQ as soon as possible to prevent the DMA from re-sampling the
same DREQ assertion.
DREQs are not required when reading from AXI peripherals. In this case, the DMA will request data
from the peripheral and the peripheral will only send the data when it is available. The DMA will not
request data that is does not have room for, so no pacing of the data flow is required.
DREQs are required when reading from APB peripherals as the AXI-to-APB bridge will not wait for an
APB peripheral to be ready and will just perform the APB read regardless. Thus an APB peripheral needs
to make sure that it has all of its read data ready before it drives its DREQ high.
When writing to peripherals, a DREQ is always required to pace the data. However, due to the pipelined
nature of the AXI bus system, several writes may be in flight before the peripheral receives any data and
withdraws its DREQ signal. Thus the peripheral must ensure that it has sufficient room in its input FIFO
to accommodate the maximum amount of data that it might receive. If the peripheral is unable to do
this, the DMA WAIT_RESP mechanism can be used to ensure that only one write is in flight at any one
time, however this is a less efficient transfer mechanism.
DREQ Peripheral
0 DREQ = 1
This is always on so use this channel if no
DREQ is required.
1 DSI0 / PWM1 **
2 PCM TX
3 PCM RX
4 SMI
5 PWM0
6 SPI0 TX
7 SPI0 RX
8 BSC/SPI Slave TX
9 BSC/SPI Slave RX
10 HDMI0
11 e.MMC
12 UART0 TX
13 SD HOST
14 UART0 RX
15 DSI1
16 SPI1 TX
17 HDMI1
18 SPI1 RX
19 UART3 TX / SPI4 TX **
20 UART3 RX / SPI4 RX **
21 UART5 TX / SPI5 TX **
22 UART5 RX / SPI5 RX **
23 SPI6 TX
27 SPI6 RX
28 UART2 TX
29 UART2 RX
DREQ Peripheral
30 UART4 TX
31 UART4 RX
* The SMI element of the Scaler FIFO 0 & SMI DREQs can be disabled by setting the SMI_DISABLE bit in
the DMA_DREQ_CONTROL register in the system arbiter control block.
** The alternate DREQs are available by changing the DMA_CNTRL_MUX bits in the PACTL_CS register in
the peri audio control block.
Peripheral (32-bit wide) read bursts are supported. The DMA will generate the burst if there is sufficient
room in its read buffer to accommodate all the data from the burst. This limits the burst size to a
maximum of 8 beats.
Read bursts in destination ignore mode (DEST_IGNORE) are supported as there is no need for the DMA
to deal with the data. This allows wide bursts of up to 16 beats to be used for efficient L2 cache fills.
DMA channel 0 and 15 are fitted with an external 128-bit 8 word read FIFO. This enables efficient
memory to memory transfers to be performed. This FIFO allows the DMA to accommodate a wide read
burst up to the size of the FIFO. In practice this will allow a 128-bit wide read burst of 9 as the first word
back will be immediately read into the DMA engine (or a 32-bit peripheral read burst of 16: 8 in the
input buffer and 8 in the FIFO). On any DMA channel, if a read burst is selected that is too large, the AXI
read bus will be stalled until the DMA has written out the data. This may lead to inefficient system
operation, and possibly AXI lock up if it causes a circular dependency.
In general write bursts are not supported. However to increase the efficiency of L2 cache fills, source
ignore (SRC_IGNORE) transfers can be specified with a write burst. In this case the DMA will issue a
write burst address sequence followed by the appropriate number of zero data, zero strobe write bus
cycles, which will cause the cache to pre-fetch the data. To improve the efficiency of the 128-bit wide bus
architecture, and to make use of the DMA’s internal 256-bit registers, the DMA will generate 128-bit wide
writes as 2 beat bursts wherever possible, although this behaviour can be disabled.
The DMA will also record any errors from an external read FIFO. These will be latched in the
FIFO_ERROR bit in the debug register until they are cleared by writing a ‘1’ to the bit. (note that only
DMA0 and 15 have an external read FIFO)
If the DMA detects that a read occurred without the AXI rlast signal being set as expected then it will set
the READ_LAST_NOT_SET_ERROR bit in the debug register. This can be cleared by writing a ‘1’ to it.
The error bits are logically OR-ed together and presented as a general ERROR bit in the CS register.
1. The internal data structure is 128 bits instead of 256 bits. This means that if you do a 128-bit wide
read burst of more than 1 beat, the DMA input register will be full and the read bus will be stalled.
The normal DMA engine can accept a read burst of 2 without stalling. If you do a narrow 32-bit read
burst from the peripherals then the lite engine can cope with a burst of 4 as opposed to a burst of 8
for the normal engine. Note that stalling the read bus will potentially reduce the overall system
performance, and may possibly cause a system lockup if you end up with a conflict where the DMA
cannot free the read bus as the read stall has prevented it writing out its data due to some circular
system relationship.
2. The Lite engine does not support 2D transfers. The TDMODE, S_STRIDE, D_STRIDE and YLENGTH
registers will all be removed. Setting these registers will have no effect.
3. The DMA length register is now 16 bits, limiting the maximum transferable length to 65536 bytes.
4. Source ignore (SRC_IGNORE) and destination ignore (DEST_IGNORE) modes are removed. The Lite
engine will have about half the bandwidth of a normal DMA engine, and are intended for low
bandwidth peripheral servicing.
The GPIO peripheral has four dedicated interrupt lines. These lines are triggered by the setting of bits in
the event detect status register. Each bank has its own interrupt line with the fourth line shared between
all bits.
The Alternate function table (Table 92) also has the pull state (pull-up/pull-down) which is applied after a
power down.
0x18 - Reserved -
0x24 - Reserved -
0x30 - Reserved -
0x3C - Reserved -
0x48 - Reserved -
0x54 - Reserved -
0x60 - Reserved -
0x6C - Reserved -
0x78 - Reserved -
0x84 - Reserved -
0x90 - Reserved -
GPFSEL0 Register
Synopsis
The function select registers are used to define the operation of the general-purpose I/O pins. Each of
the 58 GPIO pins has at least two alternative functions as defined in Section 5.3. The FSELn field
determines the functionality of the nth GPIO pin. All unused alternative function lines are tied to
ground and will output a “0” if selected. All pins reset to normal GPIO input operation.
GPFSEL1 Register
GPFSEL2 Register
GPFSEL3 Register
GPFSEL4 Register
GPFSEL5 Register
GPSET0 Register
Synopsis
The output set registers are used to set a GPIO pin. The SETn field defines the respective GPIO pin to
set, writing a “0” to the field has no effect. If the GPIO pin is being used as an input (by default) then
the value in the SETn field is ignored. However, if the pin is subsequently defined as an output then
the bit will be set according to the last set/clear operation. Separating the set and clear functions
removes the need for read-modify-write operations
GPSET1 Register
GPCLR0 Register
Synopsis
The output clear registers are used to clear a GPIO pin. The CLRn field defines the respective GPIO pin
to clear, writing a “0” to the field has no effect. If the GPIO pin is being used as an input (by default)
then the value in the CLRn field is ignored. However, if the pin is subsequently defined as an output
then the bit will be set according to the last set/clear operation. Separating the set and clear functions
removes the need for read-modify-write operations.
GPCLR1 Register
GPLEV0 Register
Synopsis
The pin level registers return the actual value of the pin. The LEVn field gives the value of the
respective GPIO pin.
GPLEV1 Register
GPEDS0 Register
Synopsis
The event detect status registers are used to record level and edge events on the GPIO pins. The
relevant bit in the event detect status registers is set whenever: 1) an edge is detected that matches
the type of edge programmed in the rising/falling edge detect enable registers, or 2) a level is detected
that matches the type of level programmed in the high/low level detect enable registers. The bit is
cleared by writing a “1” to the relevant bit.
The interrupt controller can be programmed to interrupt the processor when any of the status bits
are set. The GPIO peripheral has four dedicated interrupt lines.
Each GPIO bank can generate an independent interrupt. The fourth line generates a single interrupt
whenever any bit is set.
GPEDS1 Register
GPREN0 Register
Synopsis
The rising edge detect enable registers define the pins for which a rising edge transition sets a bit in
the event detect status registers (GPEDSn). When the relevant bits are set in both the GPRENn and
GPFENn registers, any transition (1 to 0 and 0 to 1) will set a bit in the GPEDSn registers. The GPRENn
registers use synchronous edge detection. This means the input signal is sampled using the system
clock and then it is looking for a “011” pattern on the sampled signal. This has the effect of
suppressing glitches.
GPREN1 Register
GPFEN0 Register
Synopsis
The falling edge detect enable registers define the pins for which a falling edge transition sets a bit in
the event detect status registers (GPEDSn). When the relevant bits are set in both the GPRENn and
GPFENn registers, any transition (1 to 0 and 0 to 1) will set a bit in the GPEDSn registers. The GPFENn
registers use synchronous edge detection. This means the input signal is sampled using the system
clock and then it is looking for a “100” pattern on the sampled signal. This has the effect of
suppressing glitches.
GPFEN1 Register
GPHEN0 Register
Synopsis
The high level detect enable registers define the pins for which a high level sets a bit in the event
detect status register (GPEDSn). If the pin is still high when an attempt is made to clear the status bit
in GPEDSn then the status bit will remain set.
GPHEN1 Register
GPLEN0 Register
Synopsis
The low level detect enable registers define the pins for which a low level sets a bit in the event detect
status register (GPEDSn). If the pin is still low when an attempt is made to clear the status bit in
GPEDSn then the status bit will remain set.
GPLEN1 Register
GPAREN0 Register
Synopsis
The asynchronous rising edge detect enable registers define the pins for which an asynchronous
rising edge transition sets a bit in the event detect status registers (GPEDSn).
Asynchronous means the incoming signal is not sampled by the system clock. As such rising edges of
very short duration can be detected.
GPAREN1 Register
GPAFEN0 Register
Synopsis
The asynchronous falling edge detect enable registers define the pins for which an asynchronous
falling edge transition sets a bit in the event detect status registers (GPEDSn). Asynchronous means
the incoming signal is not sampled by the system clock. As such falling edges of very short duration
can be detected.
GPAFEN1 Register
GPIO_PUP_PDN_CNTRL_REG0 Register
Synopsis
The GPIO Pull-up / Pull-down Registers control the actuation of the internal pull-up/down resistors.
Reading these registers gives the current pull-state.
The Alternate function table also has the pull state which is applied after a power down.
GPIO_PUP_PDN_CNTRL_REG1 Register
GPIO_PUP_PDN_CNTRL_REG2 Register
GPIO_PUP_PDN_CNTRL_REG3 Register
Entries which are white should not be used. These may have unexpected results as some of these have
special functions used in test mode e.g. they may drive the output with high frequency signals.
BSCSL SDA / MOSI BSC slave Data, SPI slave MOSI BSC/SPI slave
BSCSL SCL / SCLK BSC slave Clock, SPI slave clock BSC/SPI slave
and
Jitter is therefore reduced by increasing the source clock frequency. In applications where jitter is a
concern, the fastest available clock source should be used.
The General Purpose clocks have MASH noise-shaping dividers which push this fractional divider jitter
out of the audio band.
MASH noise-shaping is incorporated to push the fractional divider jitter out of the audio band if
required. The MASH can be programmed for 1, 2 or 3-stage filtering. When using the MASH filter, the
frequency is spread around the requested frequency and the user must ensure that the module is not
exposed to frequencies higher than 25MHz. Also, the MASH filter imposes a low limit on the range of
DIVI.
MASH min min output freq average output freq max output freq
DIVI
The following example illustrates the spreading of output clock frequency resulting from the use of the
MASH filter. Note that the spread is greater for lower divisors.
PLL freq target MASH divisor DIVI DIVF min freq ave freq max error
(MHz) freq (MHz) (MHz) freq
(MHz) (MHz)
It is beyond the scope of this specification to describe the operation of a MASH filter or to determine
under what conditions the available levels of filtering are beneficial.
The maximum operating frequency of the General Purpose clocks is ~125MHz at 1.2V but this will be
reduced if the GPIO pins are heavily loaded or have a capacitive load.
[8] The Broadcom Serial Control bus is a proprietary bus compliant with the Philips® I2C bus/interface
[9] BSC master 2 & 7 are not user-accessible
[10] SPI 2 is not user-accessible
Chapter 6. Interrupts
6.1. Overview
The BCM2711 has a large number of interrupts from various sources, and a choice of two interrupt
controllers. The GIC-400 interrupt controller is selected by default, but the legacy interrupt controller
can be selected with a setting in config.txt - refer to raspberrypi.org documentation for further details.
In Figure 5 the orange boxes illustrate the various interrupt source blocks, the blue box covers the
interrupt controller routing (explained later), and the green box shows the final interrupt destinations.
The number underneath each slash through the thick arrows indicates how many signals that arrow
contains (thin arrows without a number only contain one signal). The "ARM Core n" blocks in orange are
actually the same as the "ARM Core n" blocks in green, they’re just drawn as separate source and
destination blocks for clarity. ARM_LOCAL and ARMC are different hardware blocks within the chip,
each with their own set of registers; ARMC is visible to both the VPU and CPU, but ARM_LOCAL is only
visible to the CPU (and corresponds to the "ARM Local peripherals" in Chapter 1).
IRQ routing
ARM Core n
(repeated 4 times)
PS timer IRQ
PNS timer IRQ
HP timer IRQ 20
V timer IRQ 5
PMU IRQ
ARM_LOCAL
16 ARM Mailbox IRQs
AXIERR IRQ
Local timer IRQ 19
AXI_QUIET IRQ
ARM Core n
ARMC (repeated 4 times)
FIQn/IRQn
Timer IRQ FIQ
Mailbox IRQ 8
IRQ
Doorbell 0 IRQ
Doorbell 1 IRQ 2
VPU0 halt IRQ 16
VPU1 halt IRQ
ARM address error IRQ
ARM AXI error IRQ
8 software IRQs
VideoCore
62 VC peripheral IRQs 64
62
ETH_PCIe
1 secure IRQ
57 L2 IRQs
57
Figure 5. Interrupt sources and destinations
The final output from each interrupt controller is 8 separate signals - a FIQ (Fast Interrupt reQuest) and
an IRQ (Interrupt ReQuest) for each of the 4 ARM cores, i.e. FIQ0 and IRQ0 connected to ARM core 0,
FIQ1 and IRQ1 connected to ARM core 1, FIQ2 and IRQ2 connected to ARM core 2, and FIQ3 and IRQ3
connected to ARM core 3. For convenience, this document will refer to those 8 signals as FIQn/IRQn.
To avoid confusion, note that the "ARM Mailbox IRQs" in the ARM_LOCAL block are different from the
"Mailbox IRQ" in the ARMC block. Similarly, the "Local timer IRQ" in the ARM_LOCAL block is different
to the "Timer IRQ" in the ARMC block, which are both different from the 4 timer IRQs in the "ARM Core
n" block. The "AXIERR IRQ" in the ARM_LOCAL block is also different from the "ARM AXI error IRQ" in
the ARMC block.
Each of the ARM Cores can raise a Secure Physical (PS) timer interrupt, a Non-Secure Physical (PNS)
timer interrupt, a Hypervisor (HP) timer interrupt, a Virtual (V) timer interrupt and a Performance
Monitoring Unit (PMU) interrupt. For more information, please refer to the ARM Cortex-A72
documentation on the ARM Developer website.
Further information about the ARM Mailboxes can be found in Chapter 13. The AXIERR output is
asserted by the ARM’s L2 cache if an error response is received. Further information about the Local
Timer and AXI_QUIET can be found in the Registers section of this chapter.
# IRQ
0 Timer
1 Mailbox
2 Doorbell 0
3 Doorbell 1
4 VPU0 halted
5 VPU1 halted
8 Software Interrupt 0
9 Software Interrupt 1
10 Software Interrupt 2
11 Software Interrupt 3
# IRQ
12 Software Interrupt 4
13 Software Interrupt 5
14 Software Interrupt 6
15 Software Interrupt 7
The Timer interrupt in Table 99 comes from the "Timer (ARM side)" described in Chapter 12.
The eight general-purpose software interrupts can be set by writing to the SWIRQ_SET register and
cleared by writing to the SWIRQ_CLEAR register.
The 4 timer interrupts in Table 100 come from the "System Timer" described in Chapter 10.
Because there are more peripherals than available VC peripheral IRQs, some of the VC peripheral
interrupts (highlighted in bold in Table 100) are the OR-ed version of multiple peripheral interrupts.
The per-peripheral interrupt statuses for VC peripheral IRQs 29, 53, 54 & 57 can in turn be read from the
AUX_IRQ (documented in Chapter 2) and PACTL_CS (at address 0x7E20 4E00) registers. Figure 6 shows
how this is logically connected, with the vertically-aligned numbers inside the grey boxes indicating bit-
positions within the registers.
PACTL_CS
SPI0 IRQ 0
SPI1 IRQ 1
SPI2 IRQ 2
SPI3 IRQ 3 54
SPI4 IRQ 4 5
SPI5 IRQ 5
SPI6 IRQ 6
I2C0 IRQ 8
I2C1 IRQ 9
I2C2 IRQ 10
I2C3 IRQ 11
53
I2C4 IRQ 12 8
I2C5 IRQ 13
I2C6 IRQ 14
I2C7 IRQ 15
UART5 IRQ 16
UART4 IRQ 17
UART3 IRQ 18 57
5
UART2 IRQ 19
UART0 IRQ 20
For example if VC peripheral IRQ 53 is triggered, then you know at least one of the I2C peripherals has
caused an interrupt. To find out exactly which I2C peripherals have interrupts pending, you can read
bits 8 to 15 inclusive of PACTL_CS (alternatively, you could simply read the Status register for each of the
I2C peripherals).
There are also some VC peripheral interrupts (23, 24, 46 and 62) that are an OR-ed version of two
peripheral interrupt signals - if these interrupts are received the only option is to read the status register
for each of the peripherals concerned.
# IRQ
9 AVS
15 PCIE_0_INTA
16 PCIE_0_INTB
17 PCIE_0_INTC
18 PCIE_0_INTD
20 PCIE_0_MSI
29 GENET_0_A
30 GENET_0_B
48 USB0_XHCI_0
Any IRQ numbers not listed in the table above are reserved.
[11]
The secure IRQ output from the ETH_PCIe block is routed to VC peripheral IRQ 63, and all 57 ETH_PCIe
L2 IRQs are OR-ed together and routed to VC peripheral IRQ 58 - see Figure 5 and Table 100.
Note that the 57 individual ETH_PCIe interrupts aren’t routed to the legacy interrupt controller, only VC
peripheral IRQ 58 (the OR-ed version) is available.
Figure 7 shows how the interrupt sources described earlier are connected to the GIC. When the GIC-400
is selected as the interrupt controller, the eight "GIC FIQn/IRQn" outputs are routed to the FIQn/IRQn
inputs of the ARM cores.
Note that even when the GIC-400 is selected as the interrupt controller, the outputs of the legacy
interrupt controller (described later) are available as PPIs within the GIC.
GIC-400
(repeated 4 times)
Core n HP timer IRQ PPI ID 26
The GIC-400 also connects to the VFIQ (Virtual FIQ) and VIRQ (Virtual IRQ) input of each ARM core, but
for brevity these signals are not shown here.
ARM_LOCAL routing
per-core routing
(repeated 4 times)
Core n Masked FIQn Status
PS timer IRQ Masked IRQn Status
ARM Mailbox IRQs 8-11 Mailbox IRQs for Core 2 Masked FIQn Status
Core n
4 4 Mailbox IRQ 1 Masked IRQn Status
ARM Mailbox IRQs 12-15 Mailbox IRQs for Core 3
4 4 16 Core n Masked FIQn Status
Mailbox IRQ 2 Masked IRQn Status
4
AXI_QUIET IRQ
Core n Masked FIQn Status
Mailbox IRQ 3 Masked IRQn Status
Local timer IRQ
AXIERR IRQ
Masked IRQ0 Status
ARMC routing
(repeated 8 times)
one of the 8 Masked FIQn/IRQn Status
Masked FIQn/IRQn Status
ARMC peripheral IRQ 0
… etc. ...
Masked FIQn/IRQn Status
ARMC peripheral IRQ 15
The interrupts coming directly from each of the ARM cores (PS timer, PNS timer, HP timer, V timer and
PMU) can only be routed to either the FIQ or IRQ of the core from which they originate. For example the
PS timer and PMU IRQs from core 3 could be routed to FIQ3 and the PNS timer IRQ from core 2 could be
routed to IRQ2. The masking of the ARM timer IRQs is controlled by the 4 TIMER_CNTRL registers (one
for each core) and the masking of the PMU IRQs is controlled by the PMU_CONTROL_SET and
PMU_CONTROL_CLR registers.
The sixteen ARM Mailbox interrupts are allocated so that four go to each core - ARM Mailbox IRQs 0 to 3
are routed to the four Mailbox IRQs on ARM core 0, and ARM Mailbox IRQs 12 to 15 are routed to the
four Mailbox IRQs on ARM core 3, i.e. ARM Mailbox IRQ 13 appears to ARM Core 3 as Mailbox IRQ 1. Like
the ARM Core interrupts, the ARM Mailbox IRQs can only be routed to the FIQ or IRQ of the core for
which they are intended, for example the Mailbox 4 and 5 IRQs could be routed to FIQ1 and the Mailbox
10 IRQ could be routed to IRQ2. The masking of the ARM Mailbox IRQs is controlled by the four
MAILBOX_CNTRL registers (one for each core).
The AXI_QUIET IRQ is only available to the IRQ input on ARM core 0, and its masking is controlled by the
AXI_QUIET_TIME register.
The Local timer and AXIERR IRQs can be routed to any one of the 8 FIQn/IRQn signals.
The masking of the Local timer IRQ is controlled by the LOCAL_TIMER_CONTROL and PERI_IRQ_ROUTE0
registers.
The masking of the AXIERR IRQ is controlled by the ARM_CONTROL and CORE_IRQ_CONTROL registers.
The unmasked inputs to the "ARMC routing" block are readable from the IRQ_STATUS0, IRQ_STATUS1
and IRQ_STATUS2 registers.
The masking within the "ARMC routing" block is controlled by the SET_EN_0, SET_EN_1, SET_EN_2,
CLR_EN_0, CLR_EN_1 and CLR_EN_2 registers. Each of these registers is repeated for each of the eight
FIQn/IRQn signals (48 registers in total).
Once the interrupts have been masked and routed, their statuses can be read from the 3 PENDING and 1
SOURCE registers (repeated 8 times for each of the FIQn/IRQn signals, for a total of 32 registers).
These are "nested" status registers, which means if bit 8 in the SOURCE register is set, you also need to
read PENDING2 to see which bits are set there. If bit 24 in the PENDING2 register is set, then you also
need to read PENDING0 to see which bits there are set.
As a more complete example, if the interrupt routing and masking is set up so that an interrupt from
UART4 triggers a FIQ interrupt to ARM Core 3, the sequence (on ARM Core 3) would be:
2. Read FIQ_SOURCE3
5. Find that FIQ3_PENDING1[25] (i.e. VC peripheral IRQ 57) is set, so read PACTL_CS[20:16] (see Figure
6) to see which UART triggered it
6. Find that PACTL_CS[17] is set, so read UART4_MIS to (finally) determine what caused the interrupt
6.5. Registers
To allow atomic operations (where only particular bits are modified, without modifying any of the other
bits in the register), some registers are split into a write-set register and a write-clear register.
A write-set register allows you to set particular bits high (change them to 1). You set a bit high by
writing a '1' to its bit-position - bits that were low get changed to high, and bits that were already high
remain high. Any bit-positions written with a '0' retain their previous value.
0 0 0
0 1 1
1 0 1
1 1 1
A write-clear register allows you to set particular bits low (change them to 0). You set a bit low by
writing a '1' to its bit-position - bits that were low remain low, and bits that were high get changed to low.
Any bit-positions written with a '0' retain their previous value. Note that you write a one to change a bit
to zero!
0 0 0
0 1 0
1 0 1
1 1 0
6.5.1. GIC-400
The base address of the GIC-400 is 0x4 C004 0000. Note that, unlike other peripheral addresses in this
document, this is an ARM-only address and not a legacy master address. If Low Peripheral mode is
enabled this base address becomes 0x0 FF84 0000.
The GIC-400 is configured with "NUM_CPUS=4" and "NUM_SPIS=192". For full register details, please
refer to the ARM GIC-400 documentation on the ARM Developer website.
6.5.2. ARM_LOCAL
The ARM_LOCAL register base address is 0x4 C000 0000. Note that, unlike other peripheral addresses in
this document, this is an ARM-only address and not a legacy master address. If Low Peripheral mode is
enabled this base address becomes 0x0 FF80 0000.
ARM_CONTROL Register
Synopsis
Main Timer and AXI Error Control.
06 AXIERRIRQ_EN When set to '1', this bit masks the AXI Error interrupt. RW 0x0
An AXI error output is asserted by the ARM’s L2 cache if
an error response is received. If not masked, this causes
an interrupt to be raised. If this bit is set, the interrupt
is not raised.
Interrupt routing for this is controlled by the
AXI_ERR_CORE field in the CORE_IRQ_CONTROL
register.
CORE_IRQ_CONTROL Register
Synopsis
VideoCore Interrupt Routing Control
06:04 AXI_ERR_CORE Controls to which ARM core interrupt request pin the RW 0x0
external error interrupt request signal from the ARM
L2 cache is routed.
This interrupt is enabled in the AXIERRIRQ_EN field in
the ARM_CONTROL register.
0 = CORE0_IRQ
1 = CORE1_IRQ
2 = CORE2_IRQ
3 = CORE3_IRQ
4 = CORE0_FIQ
5 = CORE1_FIQ
6 = CORE2_FIQ
7 = CORE3_FIQ
PMU_CONTROL_SET Register
Synopsis
Performance Monitoring Unit (PMU) control word. Each ARM core provides a PMUIRQ output; this
control word specifies to which interrupt pins they are routed.
Writing a '1' to a bit position in this register causes the corresponding bit in the PMU control word to
be set to 1.
PMU_CONTROL_CLR Register
Synopsis
Performance Monitoring Unit (PMU) control word. Each ARM core provides a PMUIRQ output; this
control word specifies to which interrupt pins they are routed.
Writing a '1' to a bit position in this register causes the corresponding bit in the PMU control word to
be cleared to 0.
PERI_IRQ_ROUTE0 Register
Synopsis
This register controls the routing of the Local timer interrupts.
AXI_QUIET_TIME Register
Synopsis
No outstanding AXI transactions for a while.
This register controls logic that is able to generate an interrupt to the IRQ interrupt pin of ARM core 0
if there has been no AXI bus traffic for a programmable time. The intention is that software can use
this to have reasonable confidence that the bus traffic from the ARM cluster to VideoCore has ceased.
A 24-bit timer is loaded with a value equal to
16 x AXI_QUIET_TIME.AXI_QUIET_TIME + 15
whenever one or more AXI transactions are outstanding. The counter decrements on each AXI/APB
clock rising edge when no transactions are outstanding. When the counter reaches zero, the interrupt
request is generated if enabled.
19:00 AXI_QUIET_TIME Timer load value, in units of 16 AXI/APB clock cycles. RW 0x0
LOCAL_TIMER_CONTROL Register
Synopsis
Local Timer Configuration.
A free-running secondary timer is provided that can generate an interrupt each time it crosses zero.
When it is enabled, the timer is decremented on each edge (positive or negative) of the crystal
reference clock. It is automatically reloaded with the TIMER_TIMEOUT value when it reaches zero
and then continues to decrement.
Routing of the timer interrupt is controlled by the PERI_IRQ_ROUTE0 register.
31 TIMER_IRQ_FLAG This read-only field allows software to see the current RO 0x0
state of the timer interrupt request. A '1' indicates a
valid interrupt request.
LOCAL_TIMER_IRQ Register
Synopsis
Local Timer Interrupt Control
31 IRQ_CLEAR Write a '1' to this field to clear a timer interrupt request. W1SC 0x0
If the timer crosses zero at the same time as the write,
the clear operation will fail; interrupt request will
remain asserted. This bit self-clears.
30 RELOAD Write a '1' to this field to (re)load the timer with the W1SC 0x0
timeout value. This bit self-clears.
Synopsis
This register allows software to determine the cause of a FIQ interrupt request received by an ARM
core.
07 CNT_V_IRQ_FIQ When set to '1', this bit causes the 'Virtual Timer Event' RW 0x0
output to be routed to the FIQ interrupt request.
06 CNT_HP_IRQ_FIQ When set to '1', this bit causes the 'Hypervisor Physical RW 0x0
Timer Event' output to be routed to the FIQ interrupt
request.
05 CNT_PNS_IRQ_FI When set to '1', this bit causes the 'Nonsecure Physical RW 0x0
Q Timer Event' output to be routed to the FIQ interrupt
request.
04 CNT_PS_IRQ_FIQ When set to '1', this bit causes the 'Secure Physical RW 0x0
Timer Event' output to be routed to the FIQ interrupt
request.
03 CNT_V_IRQ When set to '1', this bit causes the 'Virtual Timer Event' RW 0x0
output to be routed to the IRQ interrupt request. Note
that this is overridden by the corresponding FIQ bit: a
particular event may be routed either to the FIQ or IRQ
request pin, not both. If the FIQ bit is set, then the event
will be routed to the FIQ request pin only, irrespective
of the state of this bit.
02 CNT_HP_IRQ When set to '1', this bit causes the 'Hypervisor Physical RW 0x0
Timer Event' output to be routed to the IRQ interrupt
request. Note that this is overridden by the
corresponding FIQ bit: a particular event may be routed
either to the FIQ or IRQ request pin, not both. If the FIQ
bit is set, then the event will be routed to the FIQ
request pin only, irrespective of the state of this bit.
01 CNT_PNS_IRQ When set to '1', this bit causes the 'Nonsecure Physical RW 0x0
Timer Event' output to be routed to the IRQ interrupt
request. Note that this is overridden by the
corresponding FIQ bit: a particular event may be routed
either to the FIQ or IRQ request pin, not both. If the FIQ
bit is set, then the event will be routed to the FIQ
request pin only, irrespective of the state of this bit.
00 CNT_PS_IRQ When set to '1', this bit causes the 'Secure Physical RW 0x0
Timer Event' output to be routed to the IRQ interrupt
request. Note that this is overridden by the
corresponding FIQ bit: a particular event may be routed
either to the FIQ or IRQ request pin, not both. If the FIQ
bit is set, then the event will be routed to the FIQ
request pin only, irrespective of the state of this bit.
Synopsis
This register controls the routing of the mailbox interrupts to an ARM core’s IRQ or FIQ interrupt
request pins. Each ARM can receive interrupts from four of the sixteen mailbox registers. For ARM
core 0, these are mailboxes 0-3; for ARM core 1, mailboxes 4-7 and so on.
07 MBOX3_FIQ When set to '1', this bit causes the fourth mailbox, i.e. RW 0x0
mailbox 4C+3 for ARM core number C, (so mailbox 3 for
ARM core 0, 7 for ARM core 1, etc.) to trigger a FIQ
interrupt when any bit is set in the mailbox.
06 MBOX2_FIQ When set to '1', this bit causes the third mailbox, i.e. RW 0x0
mailbox 4C+2 for ARM core number C, (so mailbox 2 for
ARM core 0, 6 for ARM core 1, etc.) to trigger a FIQ
interrupt when any bit is set in the mailbox.
05 MBOX1_FIQ When set to '1', this bit causes the second mailbox, i.e. RW 0x0
mailbox 4C+1 for ARM core number C, (so mailbox 1 for
ARM core 0, 5 for ARM core 1, etc.) to trigger a FIQ
interrupt when any bit is set in the mailbox.
04 MBOX0_FIQ When set to '1', this bit causes the first mailbox, i.e. RW 0x0
mailbox 4C for ARM core number C, (so mailbox 0 for
ARM core 0, 4 for ARM core 1, etc.) to trigger a FIQ
interrupt when any bit is set in the mailbox.
03 MBOX3_IRQ When set to '1', this bit causes the fourth mailbox, i.e. RW 0x0
mailbox 4C+3 for ARM core number C, (so mailbox 3 for
ARM core 0, 7 for ARM core 1, etc.) to trigger an IRQ
interrupt when any bit is set in the mailbox. Note that
this is overridden by the corresponding FIQ bit: a
particular event may be routed either to the FIQ or IRQ
request pin, not both. If the FIQ bit is set, then the event
will be routed to the FIQ request pin only, irrespective
of the state of this bit.
02 MBOX2_IRQ When set to '1', this bit causes the third mailbox, i.e. RW 0x0
mailbox 4C+2 for ARM core number C, (so mailbox 2 for
ARM core 0, 6 for ARM core 1, etc.) to trigger an IRQ
interrupt when any bit is set in the mailbox. Note that
this is overridden by the corresponding FIQ bit: a
particular event may be routed either to the FIQ or IRQ
request pin, not both. If the FIQ bit is set, then the event
will be routed to the FIQ request pin only, irrespective
of the state of this bit.
01 MBOX1_IRQ When set to '1', this bit causes the second mailbox, i.e. RW 0x0
mailbox 4C+1 for ARM core number C, (so mailbox 1 for
ARM core 0, 5 for ARM core 1, etc.) to trigger an IRQ
interrupt when any bit is set in the mailbox. Note that
this is overridden by the corresponding FIQ bit: a
particular event may be routed either to the FIQ or IRQ
request pin, not both. If the FIQ bit is set, then the event
will be routed to the FIQ request pin only, irrespective
of the state of this bit.
00 MBOX0_IRQ When set to '1', this bit causes the first mailbox, i.e. RW 0x0
mailbox 4C for ARM core number C, (so mailbox 0 for
ARM core 0, 4 for ARM core 1, etc.) to trigger an IRQ
interrupt when any bit is set in the mailbox. Note that
this is overridden by the corresponding FIQ bit: a
particular event may be routed either to the FIQ or IRQ
request pin, not both. If the FIQ bit is set, then the event
will be routed to the FIQ request pin only, irrespective
of the state of this bit.
Synopsis
This register allows software to determine the cause of an IRQ interrupt request received by an ARM
core.
10 AXI_QUIET No AXI outstanding requests have been seen for the RO 0x0
time-out period.
Present for Core 0 only. Reserved for others.
07:04 MAILBOX_IRQ Mailbox interrupts: bit 4 is the first of the core’s RO 0x0
mailboxes, bit 7 is the fourth.
Synopsis
This register allows software to determine the cause of a FIQ interrupt request received by an ARM
core.
07:04 MAILBOX_FIQ Mailbox interrupts: bit 4 is the first of the core’s RO 0x0
mailboxes, bit 7 is the fourth.
6.5.3. ARMC
0x210 IRQ0_SET_EN_0 Write to Set ARM Core 0 IRQ enable bits [31:0] 32
0x214 IRQ0_SET_EN_1 Write to Set ARM Core 0 IRQ enable bits [63:32] 32
0x220 IRQ0_CLR_EN_0 Write to Clear ARM Core 0 IRQ enable bits [31:0] 32
0x224 IRQ0_CLR_EN_1 Write to Clear ARM Core 0 IRQ enable bits [63:32] 32
0x228 IRQ0_CLR_EN_2 Write to Clear ARM Core 0 IRQ enable bits [79:64] 32
0x250 IRQ1_SET_EN_0 Write to Set ARM Core 1 IRQ enable bits [31:0] 32
0x254 IRQ1_SET_EN_1 Write to Set ARM Core 1 IRQ enable bits [63:32] 32
0x260 IRQ1_CLR_EN_0 Write to Clear ARM Core 1 IRQ enable bits [31:0] 32
0x264 IRQ1_CLR_EN_1 Write to Clear ARM Core 1 IRQ enable bits [63:32] 32
0x268 IRQ1_CLR_EN_2 Write to Clear ARM Core 1 IRQ enable bits [79:64] 32
0x290 IRQ2_SET_EN_0 Write to Set ARM Core 2 IRQ enable bits [31:0] 32
0x294 IRQ2_SET_EN_1 Write to Set ARM Core 2 IRQ enable bits [63:32] 32
0x2A0 IRQ2_CLR_EN_0 Write to Clear ARM Core 2 IRQ enable bits [31:0] 32
0x2A4 IRQ2_CLR_EN_1 Write to Clear ARM Core 2 IRQ enable bits [63:32] 32
0x2A8 IRQ2_CLR_EN_2 Write to Clear ARM Core 2 IRQ enable bits [79:64] 32
0x2D0 IRQ3_SET_EN_0 Write to Set ARM Core 3 IRQ enable bits [31:0] 32
0x2D4 IRQ3_SET_EN_1 Write to Set ARM Core 3 IRQ enable bits [63:32] 32
0x2E0 IRQ3_CLR_EN_0 Write to Clear ARM Core 3 IRQ enable bits [31:0] 32
0x2E4 IRQ3_CLR_EN_1 Write to Clear ARM Core 3 IRQ enable bits [63:32] 32
0x2E8 IRQ3_CLR_EN_2 Write to Clear ARM Core 3 IRQ enable bits [79:64] 32
0x310 FIQ0_SET_EN_0 Write to Set ARM Core 0 FIQ enable bits [31:0] 32
0x314 FIQ0_SET_EN_1 Write to Set ARM Core 0 FIQ enable bits [63:32] 32
0x320 FIQ0_CLR_EN_0 Write to Clear ARM Core 0 FIQ enable bits [31:0] 32
0x324 FIQ0_CLR_EN_1 Write to Clear ARM Core 0 FIQ enable bits [63:32] 32
0x328 FIQ0_CLR_EN_2 Write to Clear ARM Core 0 FIQ enable bits [79:64] 32
0x350 FIQ1_SET_EN_0 Write to Set ARM Core 1 FIQ enable bits [31:0] 32
0x354 FIQ1_SET_EN_1 Write to Set ARM Core 1 FIQ enable bits [63:32] 32
0x360 FIQ1_CLR_EN_0 Write to Clear ARM Core 1 FIQ enable bits [31:0] 32
0x364 FIQ1_CLR_EN_1 Write to Clear ARM Core 1 FIQ enable bits [63:32] 32
0x368 FIQ1_CLR_EN_2 Write to Clear ARM Core 1 FIQ enable bits [79:64] 32
0x390 FIQ2_SET_EN_0 Write to Set ARM Core 2 FIQ enable bits [31:0] 32
0x394 FIQ2_SET_EN_1 Write to Set ARM Core 2 FIQ enable bits [63:32] 32
0x3A0 FIQ2_CLR_EN_0 Write to Clear ARM Core 2 FIQ enable bits [31:0] 32
0x3A4 FIQ2_CLR_EN_1 Write to Clear ARM Core 2 FIQ enable bits [63:32] 32
0x3A8 FIQ2_CLR_EN_2 Write to Clear ARM Core 2 FIQ enable bits [79:64] 32
0x3D0 FIQ3_SET_EN_0 Write to Set ARM Core 3 FIQ enable bits [31:0] 32
0x3D4 FIQ3_SET_EN_1 Write to Set ARM Core 3 FIQ enable bits [63:32] 32
0x3E0 FIQ3_CLR_EN_0 Write to Clear ARM Core 3 FIQ enable bits [31:0] 32
0x3E4 FIQ3_CLR_EN_1 Write to Clear ARM Core 3 FIQ enable bits [63:32] 32
0x3E8 FIQ3_CLR_EN_2 Write to Clear ARM Core 3 FIQ enable bits [79:64] 32
Synopsis
Shows the status of the Enabled interrupts [31:0] (that will be OR-ed into the Core’s interrupt line)
Only Interrupts that are enabled will show up here
Synopsis
Shows the status of the Enabled interrupts [63:32] (that will be OR-ed into the Core’s interrupt line)
Only Interrupts that are enabled will show up here
Synopsis
Shows the status of the Enabled interrupts [79:64] (that will be OR-ed into the Core’s interrupt line)
Only Interrupts that are enabled will show up here
25 INT63_32 This bit is the logical OR of all the interrupt pending bits RO 0x0
for interrupts 63 to 32. If set, read the PENDING1
register to determine which interrupts are pending
from this set.
24 INT31_0 This bit is the logical OR of all the interrupt pending bits RO 0x0
for interrupts 31 to 0. If set, read the PENDING0 register
to determine which interrupts are pending from this
set.
07 ARM_AXI_ERROR ARM AXI error interrupt. This is set if the logic in the RO 0x0
ARM block detects that an AXI error has occurred. This
interrupt cannot be cleared other than by resetting the
ARM complex.
06 ARM_ADDR_ERR ARM address range error. This interrupt is set if the RO 0x0
OR ARM attempts an AXI burst (ALEN > 0) access to
VideoCore peripheral space.
04 VPU_C0_C1_HALT VPU Core 0 halted in debug mode, or (if enabled by bit RO 0x0
10 of the config register) VPU Core 1 halted in debug
mode.
Synopsis
Writing a '1' to a bit position in this register enables the corresponding interrupt.
A read returns the current state of this enable register.
Synopsis
Writing a '1' to a bit position in this register enables the corresponding interrupt.
A read returns the current state of this enable register.
Synopsis
Writing a '1' to a bit position in this register enables the corresponding interrupt.
A read returns the current state of this enable register.
07 ARM_AXI_ERROR ARM AXI error interrupt. This is set if the logic in the RW 0x0
ARM block detects that an AXI error has occurred.
06 ARM_ADDR_ERR ARM address range error. This interrupt is set if the RW 0x0
OR ARM attempts an AXI burst (ALEN > 0) access to
VideoCore peripheral space.
04 VPU_C0_C1_HALT VPU Core 0 halted in debug mode, or (if enabled by bit RW 0x0
10 of the config register) VPU Core 1 halted in debug
mode.
Synopsis
Writing a '1' to a bit position in this register disables the corresponding interrupt.
A read returns the current state of the IRQ enable register.
Synopsis
Writing a '1' to a bit position in this register disables the corresponding interrupt.
A read returns the current state of the IRQ enable register.
Synopsis
Writing a '1' to a bit position in this register disables the corresponding interrupt.
A read returns the current state of the IRQ enable register.
31 IRQ This is the value of the ARM interrupt input W1C 0x0
15:08 SW_TRIG_INT These eight bits are software-triggered interrupts. By W1C 0x0
writing to the SWIRQ_SET register, software may set
interrupt trigger bits.
07 ARM_AXI_ERROR ARM AXI error interrupt. This is set if the logic in the W1C 0x0
ARM block detects that an AXI error has occurred.
06 ARM_ADDR_ERR ARM address range error. This interrupt is set if the W1C 0x0
OR ARM attempts an AXI burst (ALEN > 0) access to
VideoCore peripheral space.
04 VPU_C0_C1_HALT VPU Core 0 halted in debug mode, or (if enabled by bit W1C 0x0
10 of the config register) VPU Core 1 halted in debug
mode.
IRQ_STATUS0 Register
Synopsis
Shows the status of the actual Interrupts [31:0] before they are masked
IRQ_STATUS1 Register
Synopsis
Shows the status of the actual Interrupts [63:32] before they are masked
IRQ_STATUS2 Register
Synopsis
Shows the status of the actual Interrupts [79:64] before they are masked
07 ARM_AXI_ERROR ARM AXI error interrupt. This is set if the logic in the RO 0x0
ARM block detects that an AXI error has occurred. This
interrupt cannot be cleared other than by resetting the
ARM complex.
06 ARM_ADDR_ERR ARM address range error. This interrupt is set if the RO 0x0
OR ARM attempts an AXI burst (ALEN > 0) access to
VideoCore peripheral space.
04 VPU_C0_C1_HALT VPU Core 0 halted in debug mode, or (if enabled by bit RO 0x0
10 of the config register) VPU Core 1 halted in debug
mode.
Synopsis
Shows the status of the Enabled interrupts [31:0] (that will be OR-ed into the Core’s interrupt line)
Only Interrupts that are enabled will show up here
Synopsis
Shows the status of the Enabled interrupts [63:32] (that will be OR-ed into the Core’s interrupt line)
Only Interrupts that are enabled will show up here
Synopsis
Shows the status of the Enabled interrupts [79:64] (that will be OR-ed into the Core’s interrupt line)
Only Interrupts that are enabled will show up here
25 INT63_32 This bit is the logical OR of all the interrupt pending bits RO 0x0
for interrupts 63 to 32. If set, read the PENDING1
register to determine which interrupts are pending
from this set.
24 INT31_0 This bit is the logical OR of all the interrupt pending bits RO 0x0
for interrupts 31 to 0. If set, read the PENDING0 register
to determine which interrupts are pending from this
set.
07 ARM_AXI_ERROR ARM AXI error interrupt. This is set if the logic in the RO 0x0
ARM block detects that an AXI error has occurred. This
interrupt cannot be cleared other than by resetting the
ARM complex.
06 ARM_ADDR_ERR ARM address range error. This interrupt is set if the RO 0x0
OR ARM attempts an AXI burst (ALEN > 0) access to
VideoCore peripheral space.
04 VPU_C0_C1_HALT VPU Core 0 halted in debug mode, or (if enabled by bit RO 0x0
10 of the config register) VPU Core 1 halted in debug
mode.
Synopsis
Writing a '1' to a bit position in this register enables the corresponding interrupt.
A read returns the current state of the FIQ enable register.
Synopsis
Writing a '1' to a bit position in this register enables the corresponding interrupt.
A read returns the current state of the FIQ enable register.
Synopsis
Writing a '1' to a bit position in this register enables the corresponding interrupt.
A read returns the current state of the FIQ enable register.
07 ARM_AXI_ERROR ARM AXI error interrupt. This is set if the logic in the RW 0x0
ARM block detects that an AXI error has occurred.
06 ARM_ADDR_ERR ARM address range error. This interrupt is set if the RW 0x0
OR ARM attempts an AXI burst (ALEN > 0) access to
VideoCore peripheral space.
04 VPU_C0_C1_HALT VPU Core 0 halted in debug mode, or (if enabled by bit RW 0x0
10 of the config register) VPU Core 1 halted in debug
mode.
Synopsis
Writing a '1' to a bit position in this register disables the corresponding interrupt.
A read returns the current state of the FIQ enable register.
Synopsis
Writing a '1' to a bit position in this register disables the corresponding interrupt.
A read returns the current state of the FIQ enable register.
Synopsis
Writing a '1' to a bit position in this register disables the corresponding interrupt.
A read returns the current state of the FIQ enable register.
31 IRQ This is the value of the ARM interrupt input W1C 0x0
15:08 SW_TRIG_INT These eight bits are software-triggered interrupts. By W1C 0x0
writing to the SWIRQ_SET register, software may set
interrupt trigger bits.
07 ARM_AXI_ERROR ARM AXI error interrupt. This is set if the logic in the W1C 0x0
ARM block detects that an AXI error has occurred.
06 ARM_ADDR_ERR ARM address range error. This interrupt is set if the W1C 0x0
OR ARM attempts an AXI burst (ALEN > 0) access to
VideoCore peripheral space.
04 VPU_C0_C1_HALT VPU Core 0 halted in debug mode, or (if enabled by bit W1C 0x0
10 of the config register) VPU Core 1 halted in debug
mode.
SWIRQ_SET Register
Synopsis
Software-triggered interrupts.
Writing a '1' to a bit position in this register sets the corresponding software interrupt source bit. A
read returns the current state of the software interrupt bits.
SWIRQ_CLEAR Register
Synopsis
Software-triggered interrupts.
Writing a '1' to a bit position in this register clears the corresponding software interrupt source bit. A
read returns the current state of the software interrupt bits.
[11] which is only useful for the VPU and not the CPU
PCM is a serial format with a single-bit data_in and single-bit data_out. Data is always serialised MS-bit
first.
The frame sync signal (PCM_FS) is used to delimit the serial data into individual frames. The length of
the frame, and the size and polarity of the frame sync, are fully programmable.
Frames can contain 1 or 2 audio/data channels in each direction. Each channel can be between 8 and 32
bits wide and can be positioned anywhere within the frame as long as the two channels don’t overlap.
The channel format is separately programmable for transmit and receive directions.
The PCM_CLK can be asynchronous to the bus APB clock and can be logically inverted if required.
The direction of the PCM_CLK and PCM_FS signals can be individually selected, allowing the interface to
act as a master or slave device.
The input interface is also capable of supporting up to 2 PDM (Pulse Density Modulation) microphones,
as an alternative to the classic PCM input format, in conjunction with a PCM output.
The PCM audio interface contains separate transmit and receive FIFOs. Note that if the frame contains
two data channels, they must share the same FIFO and so the channel data will be interleaved. The block
can be driven using simple polling, an interrupt based method or direct DMA control.
Normally PCM output signals change on the rising edge of PCM_CLK and input signals are sampled on its
falling edge. The frame sync is considered as a data signal and sampled in the same way.
The front end of the PCM audio interface is run off the PCM_CLK and the PCM signals are timed against
this clock. However, the polarity of the PCM_CLK can be physically inverted, in which case the edges are
reversed.
In clock master mode (CLKM=0), the PCM_CLK is an output and is driven from the PCM_MCLK clock
input.
In clock slave mode (CLKM=1), the PCM_CLK is an input, supplied by some external clock source.
In frame sync master mode (FSM=0), the PCM_FS is internally generated and is treated as a data output
that changes on the positive edge of the clock. The length and polarity of the frame sync is fully
programmable and it can be used as a standard frame sync signal, or as an L-R signal for I2S.
In frame sync slave mode (FSM=1), the PCM_FS is treated as a data input and is sampled on the negative
edge of PCM_CLK. The first clock of a frame is taken as the first clock period where PCM_FS is sampled as
a 1 following a period or periods where it was previously a 0. The PCM audio interface locks onto the
incoming frame sync and uses this to indicate where the data channels are positioned. The precise
timing at the start of frame is shown in Figure 12.
Note that in frame sync slave mode there are two synchronising methods. The legacy method is used
when the frame length = 0. In this case the internal frame logic has to detect the incoming PCM_FS signal
and reset the internal frame counter at the start of every frame. The logic relies on the PCM_FS to
indicate the length of the frame and so can cope with adjacent frames of different lengths. However, this
creates a short timing path that will corrupt the PCM_DOUT for one specific frame/channel setting.
The preferred method is to set the frame length to the expected length. Here the incoming PCM_FS is
used to resynchronise the internal frame counter and this eliminates the short timing path.
7.4. Operation
The PCM interface runs asynchronously at the PCM_CLK rate and automatically transfers transmit and
receive data across to the internal APB clock domain. The control registers (with the exception of
INTSTC_A and GRAY) are NOT synchronised and should be programmed before the device is enabled
and should NOT be changed whilst the interface is running.
Only the EN, RXON and TXON bits of the PCMCS register are synchronised across the PCM - APB clock
domain and are allowed to be changed whilst the interface is running.
The EN bit is a global power-saving enable. The TXON and RXON bits enable transmit and receive, and
the interface is running whenever either TXON or RXON is enabled.
In operation, the PCM format is programmed by setting the appropriate frame length, frame sync,
channel position values, and signal polarity controls. The transmit FIFO should be preloaded with data
and the interface can then be enabled and started, and will run continuously until stopped. If the receive
FIFO becomes full or the transmit FIFO becomes empty, the RXERR or TXERR error flags will be set, but
the interface will just continue. If the RX FIFO overflows, new samples are discarded and if the TX FIFO
underflows, zeros are transmitted.
Normally channel data is read or written into the appropriate FIFO as a single word. If the channel is
less than 32 bits, the data is right justified and should be padded with zeros. If the RXSEX bit is set then
the received data is sign extended up to the full 32 bits. When a frame is programmed to have two data
channels, then each channel is written/read as a separate word in the FIFO, producing an interleaved
data stream. When initialising the interface, the first word read out of the TX FIFO will be used for the
first channel, and the data from the first channel on the first frame to be received will be the first word
written into the RX FIFO.
If a FIFO error occurs in a two channel frame, then channel synchronisation may be lost which may
result in a left-right audio channel swap. RXSYNC and TXSYNC status bits are provided to help determine
if channel slip has occurred. They indicate if the number of words in the FIFO is a multiple of a full
frame (taking into account where we are in the current frame being transferred). This assumes that an
integer number of frames data has been sent/read from the FIFOs.
If a frame is programmed to have two data channels and the packed mode bits are set (FRXP / FTXP)
then the FIFOs are configured so that each word contains the data for both channels (2 x 16-bit samples).
In this mode each word written to the TX FIFO contains two 16-bit samples, and the Least Significant
sample is transmitted first. Each word read from the RX FIFO will contain the data received from two
channels, the first channel received will be in the Least Significant half of the word. If the channel’s size
is less than 16 bits, the TX data will be truncated and RX data will be padded to 16 bits with zeros.
Note that data is always serialised MS-bit first. This is well-established behaviour in both PCM and I2S.
If the PDM input mode is enabled then channel 1 is sampled on the negative edge of PCM_CLK whilst
channel 2 is sampled on the positive edge of PCM_CLK.
Note that the precise timing of PCM_FS (when it is an input) is not clearly defined and it may change
state before or after the positive edge of the clock. Here the first clock of the frame is defined as the clock
period where the PCM_FS is sampled (on a negative edge of PCM_CLK) as a 1 where it was previously
sampled as a 0.
1. Set the EN bit to enable the PCM block. Set all operational values to define the frame and channel
settings. Assert RXCLR and/or TXCLR and wait for 2 PCM clocks to ensure the FIFOs are reset. The
SYNC bit can be used to determine when 2 clocks have passed. Set RXTHR/TXTHR to determine the
FIFO thresholds.
2. If transmitting, ensure that sufficient sample words have been written to PCM FIFO before
transmission is started. Set TXON and/or RXON to begin operation.
3. Poll TXW writing sample words to PCM FIFO and poll RXR reading sample words from PCM FIFO,
until all data is transferred.
1. Set the EN bit to enable the PCM block. Set all operational values to define the frame and channel
settings. Assert RXCLR and/or TXCLR and wait for 2 PCM clocks to ensure the FIFOs are reset. The
SYNC bit can be used to determine when 2 clocks have passed. Set RXTHR/TXTHR to determine the
FIFO thresholds.
3. If transmitting, ensure that sufficient sample words have been written to PCM FIFO before
transmission is started. Set TXON and/or RXON to begin operation.
4. When an interrupt occurs, check RXR. If this is set then one or more sample words are available in
PCM FIFO. If TXW is set then one or more sample words can be sent to PCM FIFO.
7.5.3. DMA
1. Set the EN bit to enable the PCM block. Set all operational values to define the frame and channel
settings. Assert RXCLR and/or TXCLR and wait for 2 PCM clocks to ensure the FIFOs are reset. The
SYNC bit can be used to determine when 2 clocks have passed.
2. Set DMAEN to enable DMA DREQ generation and set RX_REQ/TX_REQ to determine the FIFO
thresholds for the DREQs. If required, set TX_PANIC and RX_PANIC to determine the level at which
the DMA should increase its AXI priority,
3. In the DMA controllers set the correct DREQ channels, one for RX and one for TX. Start the DMA
which should fill the TX FIFO.
The FIFOs will automatically detect an error condition caused by a FIFO over- or under-run and this will
set the appropriate latching error bit in the control/status register. Writing a ‘1’ back to this error bit will
clear the latched flag.
In a system using a polled operation, the error bits can be checked manually. For an interrupt or DMA
based system, setting the RXERR and/or TXERR bits in INTEN_A will cause the PCM interface to generate
an interrupt when an error is detected.
If a FIFO error occurs during operation in which 2 data channels are being used then the
synchronisation of the data may be lost. This can be recovered by either of these two methods:
• Disable transmit and receive (set TXON and RXON to 0). Clear the FIFOs (set RXCLR and TXCLR to 1).
Note that it may take up to 2 PCM clocks for the FIFOs to be physically cleared after initiating a clear.
Then preload the transmit FIFO and restart transmission. This of course loses the data in the FIFO
and further interrupts the data flow to the external device.
• Examine the TXSYNC and RXSYNC flags. These flags indicate if the amount of data in the FIFO is a
whole number of frames, automatically taking into account where we are in the current frame being
transmitted or received. Thus, providing an even number of samples was read or written to the
FIFOs, then if the flags are set then this indicates that a single word needs to be written or read to
adjust the data. Normal exchange of data can then proceed (where the first word in a data pair is for
channel 1). This method should cause less disruption to the data stream.
When using the PDM input mode the bit width and the rate of the data received will depend on the
decimation factor used. Once the data has been read from the peripheral a further decimation and
filtering stage will be required and can be implemented in software. The software filter should also
correct the droop introduced by the CIC filter stage. Similarly a DC correction stage should also be
employed.
In this mode data is received on the PCM_DIN (data) and the PCM_FS (strobe) pins. The data is expected
to be in data/strobe format. In this mode data is detected when either the data or the strobe change state.
As each bit is received it is written into the RX buffer and when 32 bits are received they are written out
to the RX FIFO as a 32-bit word. In order for this mode to work the user must program a PCM clock rate
which is 4 times faster then the gray data rate. Also the gray coded data input signals should be clean.
The normal RX_REQ and RXTHR FIFO levels will apply as for normal PCM received data.
If a message is received that is not a multiple of 32 bits, any data in the RX buffer can be flushed out by
setting the flush bit (FLUSH). Once set, this bit will read back as zero until the flush operation has
completed. This may take several cycles as the APB clock may be many times faster than the PCM clock.
Once the flush has occurred, the bits are packed up to 32 bits with zeros and written out to the RX FIFO.
The flushed field (FLUSHED) will indicate how many of bits of this word are valid.
Note that to get an accurate indication of the number of bits currently in the RX shift register (RXLEVEL)
the APB clock must be at least twice the PCM_CLK.
CS_A Register
Synopsis
This register contains the main control and status bits for the PCM. The bottom 3 bits of this register
can be written to whilst the PCM is running. The remaining bits cannot.
8:7 RXTHR Sets the RX FIFO threshold at which point the RXR flag RW 0x0
is set
00 = set when we have a single sample in the RX FIFO
01 = set when the RX FIFO is at least ¼ full
10 = set when the RX FIFO is at least ¾ full
11 = set when the RX FIFO is full
6:5 TXTHR Sets the TX FIFO threshold at which point the TXW flag RW 0x0
is set
00 = set when the TX FIFO is empty
01 = set when the TX FIFO is less than ¼ full
10 = set when the TX FIFO is less than ¾ full
11 = set when the TX FIFO is full but for one sample
FIFO_A Register
Synopsis
This is the FIFO port of the PCM. Data written here is transmitted, and received data is read from
here.
31:0 FIFO Data written here is transmitted, and received data is RW 0x0
read from here.
MODE_A Register
Synopsis
This register defines the basic PCM Operating Mode. It is used to configure the frame size and format
and whether the PCM is in master or slave modes for its frame sync or clock. This register cannot be
changed whilst the PCM is running.
RXC_A Register
Synopsis
Sets the Channel configurations for Receiving. This sets the position and width of the 2 receive
channels within the frame. The two channels cannot overlap, however channel 2 can come after
channel 1, although the first data will always be from the first channel in the frame. Channels can
also straddle the frame begin-end boundary (as set by the frame sync position). This register cannot
be changed whilst the PCM is running.
TXC_A Register
Synopsis
Sets the Channel configurations for Transmitting. This sets the position and width of the 2 transmit
channels within the frame. The two channels cannot overlap, however channel 2 can come after
channel 1, although the first data will always be used in the first channel in the frame. Channels can
also straddle the frame begin-end boundary (as set by the frame sync position). This register cannot
be changed whilst the PCM is running.
DREQ_A Register
Synopsis
Set the DMA DREQ and Panic thresholds. The PCM drives 2 DMA controls back to the DMA, one for
the TX channel and one for the RX channel. DMA DREQ is used to request the DMA to perform
another transfer, and DMA Panic is used to tell the DMA to use its panic level of priority when
requesting things on the AXI bus. This register cannot be changed whilst the PCM is running.
INTEN_A Register
Synopsis
Set the reasons for generating an Interrupt. This register cannot be changed whilst the PCM is
running.
INTSTC_A Register
Synopsis
This register is used to read and clear the PCM interrupt status. Writing a 1 to the asserted bit clears
the bit. Writing a 0 has no effect.
GRAY Register
Synopsis
This register is used to control the gray mode generation. This is used to put the PCM into a special
data/strobe mode. This mode is under 'best effort' contract.
15:10 FLUSHED The number of bits that were flushed into the RX FIFO RO 0x0
This indicates how many bits were valid when the flush
operation was performed. The valid bits are from bit 0
upwards. Non-valid bits are set to zero.
• Bit-streams configured individually to output either PWM or a serialised version of a 32-bit word
• Serialise mode configured to read data from a FIFO storage block, which can store up to sixty-four
32-bit words
• Both modes clocked by clk_pwm which is nominally 100MHz, but can be varied by the clock
manager
The BCM2711 device has two instances of this block, named PWM0 and PWM1 (each with two output
channels).
modulation, in which the value is represented by the duty cycle of the output signal. To send value N/M
within a periodic sequence of M cycles, output should be 1 for N cycles and 0 for (M-N) cycles. The
desired sequence should have 1s and 0s spread out as evenly as possible, so that during any arbitrary
period of time the duty cycle achieves the closest approximation of the value. This can be shown in the
following table where 4/8 is modulated (N=4, M=8).
Bad 0 0 0 0 1 1 1 1 0 0 0 0
Fair 0 0 1 1 0 0 1 1 0 0 1 1
Good 0 1 0 1 0 1 0 1 0 1 0 1
Sequence which gives the ‘good’ approximation from the table above can be achieved by the following
algorithm:
PWM mode: There are two sub-modes in PWM mode: MSEN=0 and MSEN=1.
When MSEN=0 (which is the default mode), data to be sent is interpreted as the value N of the algorithm
explained above. The number of clock cycles (range) used to send data is the value M of the algorithm.
Pulses are sent within this range so that the resulting duty cycle is N/M. The channel sends its output
continuously as long as the data register is used (USEFi=0), or the FIFO is used and it is not empty.
When MSEN=1, the PWM channel does not use the algorithm explained above, instead it sends serial
data with the M/S ratio as in Figure 15. M is the data to be sent, and S is the range. This mode may be
preferred if high frequency modulation is not required or has negative effects. The channel sends its
output continuously as long as the data register is used (USEFi=0), or the FIFO is used and it is not empty.
Serialiser mode: Each channel is also capable of working as a serialiser. In this mode data written in
the FIFO or the data register is sent serially.
• GPIOs are assigned to PWM channels as below. Please refer to the GPIO chapter for further details:
GPIO12 PWM0_0
GPIO13 PWM0_1
GPIO18 PWM0_0
GPIO19 PWM0_1
GPIO40 PWM1_0
GPIO41 PWM1_1
GPIO45 PWM0_1
CTL Register
Synopsis
PWENi is used to enable/disable the corresponding channel. Setting this bit to 1 enables the channel
and transmitter state machine. All registers and FIFOs are writeable without setting this bit.
MODEi bit is used to determine mode of operation. Setting this bit to 0 (the default) enables PWM
mode. In this mode data stored in either PWM_DATi or FIFO is transmitted by pulse width modulation
within the range defined by PWM_RNGi. When this mode is used, MSENi defines whether to use PWM
algorithm or M/S transmission. Setting MODEi to 1 enables serial mode, in which data stored in either
PWM_DATi or FIFO is transmitted serially within the range defined by PWM_RNGi. Data is
transmitted MSB first and truncated or zero-padded depending on PWM_RNGi.
RPTLi is used to enable/disable repeating of the last data available in the FIFO just before it empties.
When this bit is 1 and FIFO is used, the last available data in the FIFO is repeatedly sent. This may be
useful in PWM mode to avoid duty cycle gaps. If the FIFO is not used this bit does not have any effect.
Default operation is do-not-repeat.
SBITi defines the state of the output when no transmission takes place. It also defines the zero
polarity for the zero padding in serialiser mode. This bit is padded between two consecutive transfers
as well as tail of the data when PWM_RNGi is larger than bit depth of data being transferred. This bit
is zero by default.
POLAi is used to configure the polarity of the output bit. When set to high the final output is inverted.
Default operation is no inversion.
USEFi bit is used to enable/disable FIFO transfer. When this bit is high data stored in the FIFO is used
for transmission. When it is low, data written to PWM_DATi is transferred. This bit is 0 by default.
CLRF is used to clear the FIFO. Writing a 1 to this bit clears the FIFO. Writing 0 has no effect. This is a
one-shot operation and reading the bit always returns 0.
MSENi is used to determine whether to use PWM algorithm or simple M/S ratio transmission. When
this bit is high M/S transmission is used. This bit is zero by default. When MODEi is 1, this
configuration bit has no effect.
STA Register
Synopsis
FULL1 bit indicates the full status of the FIFO. If this bit is high the FIFO is full.
EMPT1 bit indicates the empty status of the FIFO. If this bit is high the FIFO is empty.
WERR1 bit is set to high when a write-when-full error occurs. Software must clear this bit by writing
1. Writing 0 to this bit has no effect.
RERR1 bit is set to high when a read-when-empty error occurs. Software must clear this bit by writing
1. Writing 0 to this bit has no effect.
GAPOi bit indicates that there has been a gap between transmission of two consecutive data from
FIFO. This may happen when the FIFO becomes empty after the state machine has sent a word and is
waiting for the next word. If control bit RPTLi is set to high this event will not occur. Software must
clear this bit by writing 1. Writing 0 to this bit has no effect.
BERR is set to high when an error has occurred while writing to registers via APB. This may happen if
the bus tries to write successively to same set of registers faster than the synchroniser block can cope
with. Multiple switching may occur and contaminate the data during synchronisation. Software
should clear this bit by writing 1. Writing 0 to this bit has no effect.
STAi bit indicates the current state of the channel, which is useful for debugging purposes. 0 means
the channel is not currently transmitting, 1 means channel is transmitting data.
DMAC Register
Synopsis
ENAB bit is used to start DMA.
PANIC bits are used to determine the threshold level for PANIC signal going active. Default value is 7.
DREQ bits are used to determine the threshold level for DREQ signal going active. Default value is 7.
Synopsis
This register is used to define the range for the corresponding channel. In PWM mode, evenly
distributed pulses are sent within a period of length defined by this register. In serial mode, serialised
data is transmitted within the same period. If the value in PWM_RNGi is less than 32, only the first
PWM_RNGi bits are sent resulting in a truncation. If it is larger than 32, excess zero bits are padded at
the end of data. Default value for this register is 32.
Synopsis
This register stores the 32-bit data to be sent by the PWM Controller when USEFi is 0. In PWM mode,
data is sent by pulse width modulation: the value of this register defines the number of pulses which
are sent within the period defined by PWM_RNGi. In serialiser mode, data stored in this register is
serialised and transmitted.
FIF1 Register
Synopsis
This register is the FIFO input for both the channels. Data written to this address is stored in the FIFO
and if USEFi is enabled for channel i it is used as data to be sent. This register is write-only, and
reading this register will always return bus default return value, pwm0.
When more than one channel is enabled for FIFO usage, the data written into the FIFO is shared
between these channels in turn. For example if the word series A B C D E F G H I .. is written to the
FIFO and both channels are active and configured to use FIFO, then channel 1 will transmit words A
C E G I .. and channel 2 will transmit words B D F H .. .
Note that requesting data from the FIFO is in locked-step manner and therefore requires tight
coupling of state machines of the channels. If the channel range (period) value of one channel is
different to the other, this will cause the channel with the smaller range value to wait between words,
hence resulting in gaps between words. To avoid that, each channel sharing the FIFO should be
configured to use the same range value.
Also note that the RPTLi bits are not meaningful when the FIFO is shared between channels as there
is no defined channel to own the last data in the FIFO. Therefore sharing channels must have their
RPTLi bit set to zero.
If the set of channels sharing the FIFO has been modified after a configuration change, the FIFO
should be cleared before writing new data.
Chapter 9. SPI
9.1. Overview
This serial interface peripheral supports the following features:
• Implements a 3 wire serial protocol, variously called Serial Peripheral Interface (SPI) or Synchronous
Serial Protocol (SSP).
• Implements a 2 wire version of SPI that uses a single wire as a bidirectional data wire instead of one
for each direction as in standard SPI.
In standard SPI master mode the peripheral implements the standard 3 wire serial protocol described
below.
In bidirectional SPI master mode the same SPI standard is implemented except that a single wire is used
for the data (MIMO) instead of two as in standard mode (MISO and MOSI). Bidirectional mode is used in
a similar way to standard mode, the only difference is that before attempting to read data from the
slave, you must set the read enable (SPI_REN) bit in the SPI control and status register (SPI_CS). This will
turn the bus around, and when you write to the SPI_FIFO register (with junk) a read transaction will
take place on the bus, and the read data will appear in the FIFO.
The LoSSI standard allows us to issue commands to peripherals and to transfer data to and from them.
LoSSI commands and parameters are 8 bits long, but an extra bit is used to indicate whether the byte is a
command or data. This extra bit is set high for a parameter and low for a command. The resulting 9-bit
value is serialized to the output. When reading from a LoSSI peripheral the standard allows us to read
bytes of data, as well as 24- and 32-bit words.
Commands and parameters are issued to a LoSSI peripheral by writing the 9-bit value of the command
or data into the SPI_FIFO register as you would for SPI mode. Reads are automated in that if the serial
interface peripheral detects a read command being issued, it will issue the command and complete the
read transaction, putting the received data into the FIFO.
Byte read commands are 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xda, 0xdb, 0xdc.
• SPI0: 0x7E20 4000
• SPI3: 0x7E20 4600
• SPI4: 0x7E20 4800
• SPI5: 0x7E20 4A00
• SPI6: 0x7E20 4C00
CS Register
Synopsis
This register contains the main control and status bits for the SPI.
FIFO Register
Synopsis
This register allows TX data to be written to the TX FIFO and RX data to be read from the RX FIFO.
CLK Register
Synopsis
This register allows the SPI clock rate to be set.
DLEN Register
Synopsis
This register allows the SPI data length rate to be set.
LTOH Register
Synopsis
This register allows the LoSSI output hold delay to be set.
3:0 TOH This sets the Output Hold delay in APB clocks. A value RW 0x1
of 0 causes a 1 clock delay.
DC Register
Synopsis
This register controls the generation of the DREQ and Panic signals to an external DMA engine. The
DREQ signals are generated when the FIFOs reach their defined levels and need servicing. The Panic
signals instruct the external DMA engine to raise the priority of its AXI requests.
2. Poll TXD writing bytes to SPI_FIFO, RXD reading bytes from SPI_FIFO until all data written
4. Set TA = 0
9.6.2. Interrupt
1. Set INTR and INTD. These can be left set over multiple operations.
2. Set CS, CPOL, CPHA as required and set TA = 1. This will immediately trigger a first interrupt with
DONE = 1.
3. On interrupt:
◦ If DONE is set and data to write (this means it is the first interrupt), write up to 64 bytes to
SPI_FIFO. If DONE is set and no more data, set TA = 0. Read trailing data from SPI_FIFO until RXD
is 0.
◦ If RXR is set read 48 bytes data from SPI_FIFO and if more data to write, write up to 48 bytes to
SPI_FIFO.
9.6.3. DMA
Note: In order to function correctly, each DMA channel must be set to perform 32-bit transfers when
communicating with the SPI. Either the Source or the Destination Transfer Width field in the DMA TI
register must be set to 0 (i.e. 32-bit words) depending upon whether the channel is reading or writing to
the SPI. Two DMA channels are required, one to read from and one to write to the SPI.
1. Enable DMA DREQs by setting the DMAEN bit and ADCS if required.
2. Program two DMA Control Blocks, one for each DMA controller.
3. DMA channel 1 Control Block should have its PERMAP set to SPIn TX and should be set to write
‘transfer length’ + 1 words to SPI_FIFO. The data should comprise:
a. A word with the transfer length in bytes in the top sixteen bits, and the control register settings
[7:0] in the bottom eight bits (i.e. TA = 1, CS, CPOL, CPHA as required.).
4. DMA channel 2 Control Block should have its PERMAP set to SPIn RX and should be set to read
‘transfer length’ words from SPI_FIFO.
5. Point each DMA channel at its CB and set its ACTIVE bit to 1.
9.6.4. Notes
1. The SPI Master knows nothing of the peripherals it is connected to. It always both sends and receives
bytes for every byte of the transaction.
2. SCLK is only generated during byte serial transfer. It pauses in the rest state if the next byte to send is
not ready or RXF is set.
3. Setup and Hold times related to the automatic assertion and de-assertion of the CS lines when
operating in DMA mode (DMAEN and ADCS set) are as follows:
◦ The CS line will be asserted at least 3 core clock cycles before the MSB of the first byte of the
transfer.
◦ The CS line will be de-asserted no earlier than 1 core clock cycle after the trailing edge of the final
clock pulse.
◦ If these parameters are insufficient, software control should alleviate the problem. ADCS should
be 0 allowing software to manually control the assertion and de-assertion of the CS lines.
The physical (hardware) base address for the system timers is 0x7E00 3000.
CS Register
Synopsis
System Timer Control / Status.
This register is used to record and clear timer channel comparator matches. The system timer match
bits are routed to the interrupt controller where they can generate an interrupt.
The M0-3 fields contain the free-running counter match status. Write a one to the relevant bit to clear
the match detect status bit and the corresponding interrupt request line.
CLO Register
Synopsis
System Timer Counter Lower bits.
The system timer free-running counter lower register is a read-only register that returns the current
value of the lower 32-bits of the free running counter.
31:0 CNT Lower 32-bits of the free running counter value. RO 0x0
CHI Register
Synopsis
System Timer Counter Higher bits.
The system timer free-running counter higher register is a read-only register that returns the current
value of the higher 32-bits of the free running counter.
31:0 CNT Higher 32-bits of the free running counter value. RO 0x0
Synopsis
System Timer Compare.
The system timer compare registers hold the compare value for each of the four timer channels.
Whenever the lower 32-bits of the free-running counter matches one of the compare values the
corresponding bit in the system timer control/status register is set.
The PL011 UART is a Universal Asynchronous Receiver/Transmitter. This is the ARM UART (PL011)
implementation. The UART performs serial-to-parallel conversion on data characters received from an
external peripheral device or modem, and parallel-to-serial conversion on data characters received
from the Advanced Peripheral Bus (APB).
The ARM PL011 UART has some optional functionality which can be included or left out.
• Standard asynchronous communication bits (start, stop and parity). These are added prior to
transmission and removed on reception.
• Support of the modem control functions CTS and RTS. However DCD, DSR, DTR, and RI are not
supported.
The UART clock source and associated dividers are controlled by the Clock Manager.
For the in-depth UART overview, please refer to the ARM PrimeCell UART (PL011) Revision: r1p5
Technical Reference Manual.
• Receive FIFO trigger levels are 1/8, 1/4, 1/2, 3/4, and 7/8
• Transmit FIFO trigger levels are 1/8, 1/4, 1/2, 3/4, and 7/8
• The internal register map address space, and the bit function of each register differ
• UARTRXINTR
• UARTTXINTR
• UARTRTINTR
One can enable or disable the individual interrupts by changing the mask bits in the Interrupt Mask
Set/Clear Register, UART_IMSC. Setting the appropriate mask bit HIGH enables the interrupt.
UARTTXINTR
The transmit interrupt changes state when one of the following events occurs:
• If the FIFOs are enabled and the transmit FIFO is equal to or lower than the programmed trigger
level then the transmit interrupt is asserted HIGH. The transmit interrupt is cleared by writing
data to the transmit FIFO until it becomes greater than the trigger level, or by clearing the
interrupt.
• If the FIFOs are disabled (have a depth of one location) and there is no data present in the
transmitter’s single location, the transmit interrupt is asserted HIGH. It is cleared by performing a
single write to the transmit FIFO, or by clearing the interrupt.
UARTRXINTR
The receive interrupt changes state when one of the following events occurs:
• If the FIFOs are enabled and the receive FIFO reaches the programmed trigger level. When this
happens, the receive interrupt is asserted HIGH. The receive interrupt is cleared by reading data
from the receive FIFO until it becomes less than the trigger level, or by clearing the interrupt.
• If the FIFOs are disabled (have a depth of one location) and data is received thereby filling the
location, the receive interrupt is asserted HIGH. The receive interrupt is cleared by performing a
single read of the receive FIFO, or by clearing the interrupt.
• UART0: 0x7E20 1000
• UART2: 0x7E20 1400
• UART3: 0x7E20 1600
• UART4: 0x7E20 1800
• UART5: 0x7E20 1A00
0x04 RSRECR 32
DR Register
Synopsis
The UART_DR Register is the data register.
For words to be transmitted:
if the FIFOs are enabled, data written to this location is pushed onto the transmit FIFO.
if the FIFOs are not enabled, data is stored in the transmitter holding register (the bottom word of the
transmit FIFO).
The write operation initiates transmission from the UART. The data is prefixed with a start bit,
appended with the appropriate parity bit (if parity is enabled), and a stop bit. The resultant word is
then transmitted.
RSRECR Register
Synopsis
The UART_RSRECR Register is the receive status register/error clear register. If the status is read from
this register, then the status information for break, framing and parity corresponds to the data
character read from the Data Register, UART_DR. The status information for overrun is set
immediately when an overrun condition occurs. NOTE: The received data character must be read
first from the Data Register UART_DR, before reading the error status associated with that data
character from this register.
FR Register
Synopsis
The UART_FR Register is the flag register.
7 TXFE Transmit FIFO empty. The meaning of this bit depends RO 0x1
on the state of the FEN bit in the Line Control Register,
UART_LCRH.
If the FIFO is disabled, this bit is set when the transmit
holding register is empty.
If the FIFO is enabled, the TXFE bit is set when the
transmit FIFO is empty. This bit does not indicate if
there is data in the transmit shift register.
6 RXFF Receive FIFO full. The meaning of this bit depends on RO 0x0
the state of the FEN bit in the UART_LCRH Register.
If the FIFO is disabled, this bit is set when the receive
holding register is full.
If the FIFO is enabled, the RXFF bit is set when the
receive FIFO is full.
5 TXFF Transmit FIFO full. The meaning of this bit depends on RO 0x0
the state of the FEN bit in the UART_LCRH Register.
If the FIFO is disabled, this bit is set when the transmit
holding register is full.
If the FIFO is enabled, the TXFF bit is set when the
transmit FIFO is full.
4 RXFE Receive FIFO empty. The meaning of this bit depends on RO 0x0
the state of the FEN bit in the UART_LCRH Register.
If the FIFO is disabled, this bit is set when the receive
holding register is empty.
If the FIFO is enabled, the RXFE bit is set when the
receive FIFO is empty.
3 BUSY UART busy. If this bit is set to 1, the UART is busy RO 0x0
transmitting data. This bit remains set until the
complete byte, including all the stop bits, has been sent
from the shift register.
This bit is set as soon as the transmit FIFO becomes
non-empty, regardless of whether the UART is enabled
or not.
0 CTS Clear to send. This bit is the complement of the UART RO 0x0
clear to send, nUARTCTS, modem status input. That is,
the bit is 1 when nUARTCTS is LOW.
ILPR Register
Synopsis
This is the disabled IrDA register, writing to it has no effect and reading returns 0.
IBRD Register
Synopsis
The UART_IBRD Register is the integer part of the baud rate divisor value.
FBRD Register
Synopsis
The UART_FBRD Register is the fractional part of the baud rate divisor value.
The baud rate divisor is calculated as follows:
Baud rate divisor BAUDDIV = (FUARTCLK/(16 * Baud rate))
where FUARTCLK is the UART reference clock frequency. The BAUDDIV is comprised of the integer
value IBRD and the fractional value FBRD.
NOTE: The contents of the IBRD and FBRD registers are not updated until transmission or reception
of the current character is complete.
LCRH Register
Synopsis
The UART_LCRH Register is the line control register.
NOTE: The UART_LCRH, UART_IBRD, and UART_FBRD registers must not be changed:
when the UART is enabled
when completing a transmission or a reception when it has been programmed to become disabled.
6:5 WLEN Word length. These bits indicate the number of data RW 0x0
bits transmitted or received in a frame as follows:
b11 = 8 bits
b10 = 7 bits
b01 = 6 bits
b00 = 5 bits.
3 STP2 Two stop bits select. If this bit is set to 1, two stop bits RW 0x0
are transmitted at the end of the frame. The receive
logic does not check for two stop bits being received.
2 EPS Even parity select. Controls the type of parity the UART RW 0x0
uses during transmission and reception:
0 = odd parity. The UART generates or checks for an odd
number of 1s in the data and parity bits.
1 = even parity. The UART generates or checks for an
even number of 1s in the data and parity bits.
This bit has no effect when the PEN bit disables parity
checking and generation. See Table 178.
1 1 0 Even parity
1 0 0 Odd parity
1 0 1 1
1 1 1 0
CR Register
Synopsis
The UART_CR Register is the control register.
NOTE: To enable transmission, the TXE bit and UARTEN bit must be set to 1. Similarly, to enable
reception, the RXE bit and UARTEN bit, must be set to 1.
NOTE: Program the control registers as follows:
3. Flush the transmit FIFO by setting the FEN bit to 0 in the Line Control Register, UART_LCRH.
15 CTSEN CTS hardware flow control enable. If this bit is set to 1, RW 0x0
CTS hardware flow control is enabled. Data is only
transmitted when the nUARTCTS signal is asserted.
14 RTSEN RTS hardware flow control enable. If this bit is set to 1, RW 0x0
RTS hardware flow control is enabled. Data is only
requested when there is space in the receive FIFO for it
to be received.
11 RTS Request to send. This bit is the complement of the UART RW 0x0
request to send, nUARTRTS, modem status output. That
is, when the bit is programmed to a 1 then nUARTRTS is
LOW.
9 RXE Receive enable. If this bit is set to 1, the receive section RW 0x1
of the UART is enabled. Data reception occurs for UART
signals. When the UART is disabled in the middle of
reception, it completes the current character before
stopping.
IFLS Register
Synopsis
The UART_IFLS Register is the interrupt FIFO level select register. You can use this register to define
the FIFO level that triggers the assertion of the combined interrupt signal.
The interrupts are generated based on a transition through a level rather than being based on the
level. That is, the interrupts are generated when the fill level progresses through the trigger level.
The bits are reset so that the trigger level is when the FIFOs are at the half-way mark.
5:3 RXIFLSEL Receive interrupt FIFO level select. The trigger points RW 0x2
for the receive interrupt are as follows:
b000 = Receive FIFO becomes 1/8 full
b001 = Receive FIFO becomes 1/4 full
b010 = Receive FIFO becomes 1/2 full
b011 = Receive FIFO becomes 3/4 full
b100 = Receive FIFO becomes 7/8 full
b101-b111 = reserved.
2:0 TXIFLSEL Transmit interrupt FIFO level select. The trigger points RW 0x2
for the transmit interrupt are as follows:
b000 = Transmit FIFO becomes 1/8 full
b001 = Transmit FIFO becomes 1/4 full
b010 = Transmit FIFO becomes 1/2 full
b011 = Transmit FIFO becomes 3/4 full
b100 = Transmit FIFO becomes 7/8 full
b101-b111 = reserved.
IMSC Register
Synopsis
The UART_IMSC Register is the interrupt mask set/clear register. It is a read/write register. On a read
this register returns the current value of the mask on the relevant interrupt. On a write of 1 to the
particular bit, it sets the corresponding mask of that interrupt. A write of 0 clears the corresponding
mask.
9 BEIM Break error interrupt mask. A read returns the current RW 0x0
mask for the UARTBEINTR interrupt. On a write of 1,
the mask of the interrupt is set. A write of 0 clears the
mask.
8 PEIM Parity error interrupt mask. A read returns the current RW 0x0
mask for the UARTPEINTR interrupt. On a write of 1,
the mask of the interrupt is set. A write of 0 clears the
mask.
RIS Register
Synopsis
The UART_RIS Register is the raw interrupt status register. It is a read-only register. This register
returns the current raw status value, prior to masking, of the corresponding interrupt.
NOTE: All the bits, except for the modem status interrupt bits (bits 3 to 0), are cleared to 0 when reset.
The modem status interrupt bits are undefined after reset.
9 BERIS Break error interrupt status. Returns the raw interrupt RO 0x0
state of the UARTBEINTR interrupt.
8 PERIS Parity error interrupt status. Returns the raw interrupt RO 0x0
state of the UARTPEINTR interrupt.
4 RXRIS Receive interrupt status. Returns the raw interrupt state RO 0x0
of the UARTRXINTR interrupt.
MIS Register
Synopsis
The UART_MIS Register is the masked interrupt status register. This register returns the current
masked status value of the corresponding interrupt.
NOTE: All the bits, except for the modem status interrupt bits (bits 3 to 0), are cleared to 0 when reset.
The modem status interrupt bits are undefined after reset.
ICR Register
Synopsis
The UART_ICR Register is the interrupt clear register.
DMACR Register
Synopsis
The UART_DMACR Register is the DMA control register.
2 DMAONERR DMA on error. If this bit is set to 1, the DMA receive RW 0x0
request outputs are disabled when the UART error
interrupt is asserted.
1 TXDMAE Transmit DMA enable. If this bit is set to 1, DMA for the RW 0x0
transmit FIFO is enabled.
0 RXDMAE Receive DMA enable. If this bit is set to 1, DMA for the RW 0x0
receive FIFO is enabled.
ITCR Register
Synopsis
This is the Test Control Register UART_ITCR.
1 ITCR1 Test FIFO enable. When this bit it 1, a write to the Test RW 0x0
Data Register, UART_TDR writes data into the receive
FIFO, and reading from the UART_TDR register reads
data out of the transmit FIFO.
When this bit is 0, data cannot be read directly from the
transmit FIFO or written directly to the receive FIFO
(normal operation).
0 ITCR0 Integration test enable. When this bit is 1, the UART is RW 0x0
placed in integration test mode, otherwise it is in
normal operation.
ITIP Register
Synopsis
This is the Test Control Register UART_ITIP.
3 ITIP3 Reads return the value of the nUARTCTS primary input. RW 0x0
0 ITIP0 Reads return the value of the UARTRXD primary input. RW 0x0
ITOP Register
Synopsis
This is the Test Control Register UART_ITOP.
TDR Register
Synopsis
UART_TDR is the test data register. It enables data to be written into the receive FIFO and read out
from the transmit FIFO for test purposes. This test function is enabled by the ITCR1 bit in the Test
Control Register, UART_ITCR.
10:0 TDR10_0 When the ITCR1 bit is set to 1, data is written into the RW 0x0
receive FIFO and read out of the transmit FIFO.
The clock from the ARM timer is derived from the system clock. This clock can change dynamically e.g. if
the system goes into reduced power or in low power mode. Thus the clock speed adapts to the overall
system performance capabilities. For accurate timing it is recommended to use the system timers.
LOAD Register
Synopsis
The timer load register sets the time for the timer to count down. This value is loaded into the timer
value register after the load register has been written or if the timer-value register has counted down
to 0.
VALUE Register
Synopsis
This register holds the current timer value and is counted down when the counter is running. It is
counted down each timer clock until the value 0 is reached. Then the value register is re-loaded from
the timer load register and the interrupt pending bit is set. The timer count down speed is set by the
timer pre-divide register.
CONTROL Register
Synopsis
The standard SP804 timer control register consists of 8 bits but in the BCM2711 implementation there
are more control bits for the extra features. Control bits 0-7 are identical to the SP804 bits, albeit some
functionality of the SP804 is not implemented. All new control bits start from bit 8 upwards.
Differences between a real 804 and the BCM2711 implementation are shown in italics.
IRQCNTL Register
Synopsis
The timer IRQ clear register is write-only. When writing this register the interrupt-pending bit is
cleared.
When reading this register it returns 0x544D5241 which is the ASCII reversed value for "ARMT".
RAWIRQ Register
Synopsis
The raw IRQ register is a read-only register. It shows the status of the interrupt pending bit.
The interrupt pending bit is set each time the value register is counted down to zero. The interrupt
pending bit can not by itself generate interrupts. Interrupts can only be generated if the interrupt enable
bit is set.
MSKIRQ Register
Synopsis
The masked IRQ register is a read-only register. It shows the status of the interrupt signal. It is simply
a logical AND of the interrupt pending bit and the interrupt enable bit.
RELOAD Register
Synopsis
This register is a copy of the timer load register. The difference is that a write to this register does not
trigger an immediate reload of the timer value register. Instead the timer load register value is only
accessed if the value register has finished counting down to zero.
PREDIV Register
The pre-divider register is 10 bits wide and can be written or read from. This register has been added as
the SP804 expects a 1MHz clock which we do not have. Instead the pre-divider takes the APB clock and
divides it down according to:
FREECNT Register
The free running counter is a 32-bit wide read-only register. The register is enabled by setting bit 9 of the
Timer control register. The free running counter is incremented immediately after it is enabled. The
timer can not be reset but when enabled, will always increment and roll-over. The free running counter
is also running from the APB clock and has its own clock pre-divider controlled by bits 16-23 of the timer
control register.
This register will be halted too if bit 8 of the control register is set and the ARM is in Debug Halt mode.
There are no differences between any of the ARM mailboxes, so it is left to the programmer to decide
how to use them. Mailbox bits can be set by writing to the appropriate MBOX_SET register. Each mailbox
generates an interrupt whenever any of its bits are non-zero - refer to Chapter 6 for details on how these
interrupts are routed. The mailbox’s value can be read from the appropriate MBOX_CLR register, and
mailbox bits can be cleared by writing to the appropriate MBOX_CLR register (these last two steps would
typically be performed inside the relevant ARM core’s interrupt handler).
13.2. Registers
The ARM_LOCAL register base address is 0x4 C000 0000. Note that, unlike other peripheral addresses in
this document, this is an ARM-only address and not a legacy master address. If Low Peripheral mode is
enabled this base address becomes 0x0 FF80 0000.
The write-set registers (MBOX_SET) are write-only, but the write-clear registers (MBOX_CLR) are read-
write.
Synopsis
Writing a '1' to a bit position in this register causes the corresponding bit in the mailbox word to be
set to 1.
There are 16 mailboxes in total, four per ARM core. Mailboxes 4C to 4C+3 'belong' to core number C.
Each mailbox may raise an interrupt to its core when any bits in the 32-bit word are set to '1'.
Synopsis
Writing a '1' to a bit position in this register causes the corresponding bit in the mailbox word to be
cleared to 0. A read returns the current state of the mailbox word.
There are 16 mailboxes in total, four per ARM core. Mailboxes 4C to 4C+3 'belong' to core number C.
Each mailbox may raise an interrupt to its core when any bits in the 32-bit word are set to '1'.
[12] Note that these are distinct from the VPU Mailboxes in the ARMC block