BCM2835 contains the following peripherals which may safely be accessed by the ARM:
• Timers
• Interrupt controller
• GPIO
• USB
• PCM / I2S
• DMA controller
• I2C master
• I2C / SPI slave
• SPI0, SPI1, SPI2
• PWM
• UART0, UART1
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 BCM2835.
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.
1.2 Address map
1.2.1 Diagrammatic overview
In addition to the ARM’s MMU, BCM2835 includes a second coarse-grained MMU for
mapping ARM physical addresses onto system bus addresses. This diagram shows the main
address spaces of interest:
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 4
• issued as virtual addresses by the ARM core, then
• mapped into a physical address by the ARM MMU, then
• mapped into a bus address by the ARM mapping MMU, and finally
• used to select the appropriate peripheral or location in RAM.
1.2.2 ARM virtual addresses (standard Linux kernel only)
As is standard practice, the standard BCM2835 Linux kernel provides a contiguous mapping
over the whole of available RAM at the top of memory. The kernel is configured for a
1GB/3GB split between kernel and user-space memory.
The split between ARM and GPU memory is selected by installing one of the supplied
start*.elf files as start.elf in the FAT32 boot partition of the SD card. The minimum amount
of memory which can be given to the GPU is 32MB, but that will restrict the multimedia
performance; for example, 32MB does not provide enough buffering for the GPU to do
1080p30 video decoding.
Virtual addresses in kernel mode will range between 0xC0000000 and 0xEFFFFFFF.
Virtual addresses in user mode (i.e. seen by processes running in ARM Linux) will range
between 0x00000000 and 0xBFFFFFFF.
Peripherals (at physical address 0x20000000 on) are mapped into the kernel virtual address
space starting at address 0xF2000000. Thus a peripheral advertised here at bus address
0x7Ennnnnn is available in the ARM kenel at virtual address 0xF2nnnnnn.
1.2.3 ARM physical addresses
Physical addresses start at 0x00000000 for RAM.
• The ARM section of the RAM starts at 0x00000000.
• The VideoCore section of the RAM is mapped in only if the system is configured to
support a memory mapped display (this is the common case).
The VideoCore MMU maps the ARM physical address space to the bus address space seen
by VideoCore (and VideoCore peripherals). The bus addresses for RAM are set up to map
onto the uncached1 bus address range on the VideoCore starting at 0xC0000000.
Physical addresses range from 0x20000000 to 0x20FFFFFF for peripherals. The bus
addresses for peripherals are set up to map onto the peripheral bus address range starting at
0x7E000000. Thus a peripheral advertised here at bus address 0x7Ennnnnn is available at
physical address 0x20nnnnnn.
1.2.4 Bus addresses
The peripheral addresses specified in this document are bus addresses. Software directly
accessing peripherals must translate these addresses into physical or virtual addresses, as
described above. Software accessing peripherals using the DMA engines must use bus
addresses.
1
BCM2835 provides a 128KB system L2 cache, which is used primarily by the GPU. Accesses to memory are
routed either via or around the L2 cache depending on senior two bits of the bus address.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 6
Software accessing RAM directly must use physical addresses (based at 0x00000000).
Software accessing RAM using the DMA engines must use bus addresses (based at
0xC0000000).
1.3 Peripheral access precautions for correct memory ordering
The BCM2835 system uses an AMBA AXI-compatible interface structure. In order to keep
the system complexity low and data throughput high, the BCM2835 AXI system does not
always return read data in-order2. The GPU has special logic to cope with data arriving outof-order; however the ARM core does not contain such logic. Therefore some precautions
must be taken when using the ARM to access peripherals.
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:
• A memory write barrier before the first write to a peripheral.
• A memory read barrier after the last read of a peripheral.
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 so you should 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.
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:
Without precuations the values ending up in the variables a_status and b_status can be swapped around.
It is theoretical 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:
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.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 7
The Device has three Auxiliary peripherals: One mini UART and two SPI masters. These
three peripheral are grouped together as they share the same area in the peripheral register
map and they share a common interrupt. Also all three are controlled by the auxiliary enable
register.
Auxiliary peripherals Register Map
(offset = 0x7E21 5000)
Address Register Name3 Description Size
0x7E21 5000 AUX_IRQ Auxiliary Interrupt status 3
0x7E21 5004 AUX_ENABLES Auxiliary enables 3
0x7E21 5040 AUX_MU_IO_REG Mini Uart I/O Data 8
0x7E21 5044 AUX_MU_IER_REG Mini Uart Interrupt Enable 8
0x7E21 5048 AUX_MU_IIR_REG Mini Uart Interrupt Identify 8
0x7E21 504C AUX_MU_LCR_REG Mini Uart Line Control 8
0x7E21 5050 AUX_MU_MCR_REG Mini Uart Modem Control 8
0x7E21 5054 AUX_MU_LSR_REG Mini Uart Line Status 8
0x7E21 5058 AUX_MU_MSR_REG Mini Uart Modem Status 8
0x7E21 505C AUX_MU_SCRATCH Mini Uart Scratch 8
0x7E21 5060 AUX_MU_CNTL_REG Mini Uart Extra Control 8
0x7E21 5064 AUX_MU_STAT_REG Mini Uart Extra Status 32
0x7E21 5068 AUX_MU_BAUD_REG Mini Uart Baudrate 16
0x7E21 5080 AUX_SPI0_CNTL0_REG SPI 1 Control register 0 32
0x7E21 5084 AUX_SPI0_CNTL1_REG SPI 1 Control register 1 8
0x7E21 5088 AUX_SPI0_STAT_REG SPI 1 Status 32
0x7E21 5090 AUX_SPI0_IO_REG SPI 1 Data 32
0x7E21 5094 AUX_SPI0_PEEK_REG SPI 1 Peek 16
0x7E21 50C0 AUX_SPI1_CNTL0_REG SPI 2 Control register 0 32
0x7E21 50C4 AUX_SPI1_CNTL1_REG SPI 2 Control register 1 8
3
These register names are identical to the defines in the AUX_IO header file. For programming purposes these
names should be used wherever possible.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 8
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.
AUXIRQ Register (0x7E21 5000)
YNOPSIS
The AUXIRQ register is used to check any pending interrupts which may be asserted by
the three Auxiliary sub blocks.
Bit(s) Field Name Description Type Reset
31:3
2
1
0
Reserved, write zero, read as don’t care
SPI 2 IRQ If set the SPI 2 module has an interrupt pending. R 0
SPI 1 IRQ If set the SPI1 module has an interrupt pending. R 0
Mini UART
If set the mini UART has an interrupt pending. R 0
IRQ
AUXENB Register (0x7E21 5004)
YNOPSIS
The AUXENB register is used to enable the three modules; UART, SPI1, SPI2.
Bit(s) Field Name Description Type Reset
31:3
2
Reserved, write zero, read as don’t care
SPI2 enable If set the SPI 2 module is enabled.
R/W 0
If clear the SPI 2 module is disabled. That also
disables any SPI 2 module register access
1
SPI 1 enable If set the SPI 1 module is enabled.
R/W 0
If clear the SPI 1 module is disabled. That also
disables any SPI 1 module register access
0
Mini UART
enable
If set the mini UART is enabled. The UART will
immediately start receiving data, especially if the
R/W 0
UART1_RX line is low.
If clear the mini UART is disabled. That also disables
any mini UART register access
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 9
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 the before enabling the UART. The UART core is build 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 stop bit and is only used so there is clean timing start for the
next bit.
Looking after a reset: the baudrate 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 the FIFO is full and
overflowing in no time flat.
2.2 Mini UART
The mini UART is a secondary low throughput4 UART intended to be used as a console. It
needs to be enabled before it can be used. It is also recommended that the correct GPIO
function mode is selected before enabling the mini Uart.
The mini Uart has the following features:
• 7 or 8 bit operation.
• 1 start and 1 stop bit.
• No parities.
• Break generation.
• 8 symbols deep FIFOs for receive and transmit.
• SW controlled RTS, SW readable CTS.
• Auto flow control with programmable FIFO level.
• 16550 like registers.
• Baudrate derived from system clock.
This is a mini UART and it does NOT have the following capabilities:
• Break detection
• Framing errors detection.
• Parity bit
• Receive Time-out interrupt
• DCD, DSR, DTR or RI signals.
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. Al 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.
4
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.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 10
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:
__
freqclocksystem
baudrate
=
()
regbaudrate
1_*8
+
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.
2.2.2 Mini UART register details.
AUX_MU_IO_REG Register (0x7E21 5040)
YNOPSIS
The AUX_MU_IO_REG register is primary 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)
Bit(s) Field Name Description Type Reset
31:8
7:0
7:0
Reserved, write zero, read as don’t care
LS 8 bits
Baudrate
read/write,
DLAB=1
Transmit data
write,
DLAB=0
Access to the LS 8 bits of the 16-bit baudrate
register.
(Only If bit 7 of the line control register (DLAB bit)
is set)
Data written is put in the transmit FIFO (Provided it
is not full)
(Only If bit 7 of the line control register (DLAB bit)
R/W 0
W 0
is clear)
7:0
Receive data
read,
DLAB=0
Data read is taken from the receive FIFO (Provided
it is not empty)
(Only If bit 7 of the line control register (DLAB bit)
R 0
is clear)
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 11
The AUX_MU_IER_REG register is primary 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)
Bit(s) Field Name Description Type Reset
31:8
7:0
Reserved, write zero, read as don’t care
MS 8 bits
Baudrate
read/write,
Access to the MS 8 bits of the 16-bit baudrate register.
(Only If bit 7 of the line control register (DLAB bit) is
set)
R/w 0
DLAB=1
7:2
Reserved, write zero, read as don’t care
Some of these bits have functions in a 16550
compatible UART but are ignored here
1
0
Enable receive
interrupt
(DLAB=0)
Enable
transmit
interrupt
If this bit is set the interrupt line is asserted whenever
the receive FIFO holds at least 1 byte.
If this bit is clear no receive interrupts are generated.
If this bit is set the interrupt line is asserted whenever
the transmit FIFO is empty.
If this bit is clear no transmit interrupts are generated.
R 0
R 0
(DLAB=0)
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 12
The AUX_MU_LSR_REG register shows the data status.
Bit(s) Field Name Description Type Reset
31:8
7
Reserved, write zero, read as don’t care
Reserved, write zero, read as don’t care
This bit has a function in a 16550 compatible UART
0
but is ignored here
6
5
4:2
Transmitter
idle
Transmitter
empty
This bit is set if the transmit FIFO is empty and the
transmitter is idle. (Finished shifting out the last bit).
This bit is set if the transmit FIFO can accept at least
one byte.
Reserved, write zero, read as don’t care
Some of these bits have functions in a 16550
R 1
R 0
0
compatible UART but are ignored here
1
Receiver
Overrun
This bit is set if there was a receiver overrun. That is:
one or more characters arrived whilst the receive
R/C 0
FIFO was full. The newly arrived charters 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
R 0
symbol.
AUX_MU_MSR_REG Register (0x7E21 5058)
YNOPSIS
The AUX_MU_MSR_REG register shows the 'modem' status.
Bit(s) Field Name Description Type Reset
31:8
7:6
Reserved, write zero, read as don’t care
Reserved, write zero, read as don’t care
Some of these bits have functions in a 16550
0
compatible UART but are ignored here
5 CTS status
This bit is the inverse of the UART1_CTS input Thus
R 1
:
If set the UART1_CTS pin is low
If clear the UART1_CTS pin is high
3:0
Reserved, write zero, read as don’t care
Some of these bits have functions in a 16550
0
compatible UART but are ignored here
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 15
If this bit is set the RTS line will de-assert if the
receive FIFO reaches it 'auto flow' level. In fact the
RTS line 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.
R/W 0
1
Transmitter
enable
If this bit is set the mini UART transmitter is enabled.
If this bit is clear the mini UART transmitter is
R/W 1
disabled
0
Receiver
enable
If this bit is set the mini UART receiver is enabled.
If this bit is clear the mini UART receiver is disabled
R/W 1
Receiver enable
If this bit is set no new symbols will be accepted by the receiver. Any symbols in progress of
reception will be finished.
Transmitter enable
If this bit is set no new symbols will be send the transmitter. Any symbols in progress of
transmission will be finished.
Auto flow control
Automatic flow control can be enabled independent for the receiver and the transmitter.
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-asserted 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).
Auto flow polarity
To offer full flexibility the polarity of the CTS and RTS (RTR) lines can be programmed.
This should allow the mini UART to interface with any existing hardware flow control
available.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 17
If this bit is set the mini UART receive FIFO contains
at least 1 symbol
R 0
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 Register (0x7E21 5068)
YNOPSIS
The AUX_MU_BAUD register allows direct access to the 16-bit wide baudrate counter.
Bit(s) Field Name Description Type Reset
31:16
Reserved, write zero, read as don’t care
15:0 Baudrate mini UART baudrate counter R/W 0
This is the same register as is accessed using the LABD bit and the first two register, but
much easier to access.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 19
The two universal SPI masters are secondary low throughput5 SPI interfaces. Like the UART
the devices needs to be enabled before they can be used. Each SPI master has the following
features:
• Single beat bit length between 1 and 32 bits.
• Single beat variable bit length between 1 and 24 bits
• Multi beat infinite bit length.
• 3 independent chip selects per master.
• 4 entries 32-bit wide transmit and receive FIFOs.
• Data out on rising or falling clock edge.
• Data in on rising or falling clock edge.
• Clock inversion (Idle high or idle low).
• Wide clocking range.
• Programmable data out hold time.
• Shift in/out MS or LS bit first
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.
2.3.1 SPI implementation details
The following diagrams shows a typical SPI access cycle. In this case we have 8 SPI clocks.
Clk
Cs_n
1 Bit time
Set-up Operate
Hold
(optional)
Idle
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 halfbit 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).
5
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.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 20
Last 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.
The SPI clock frequency is:
__
freqclocksystem
_
=
CLKSPIx
fieldspeed
)1_(*2
+
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. Note that there
is no "receive FIFO full" interrupt as the number of entries received is always equal to 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 all
received data as well.
2.3.3 Long bit streams
The SPI module works in bursts of maximum 32 bits. Some SPI devices require data which
is longer the 32 bits. To do this the user must make use of the two different data TX
addresses: Tx data written to one address cause the CS to remain asserted. Tx data written to
the other address cause 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.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 21
If 1 data is clocked out on the rising edge of the SPI
clock
If 0 data is clocked out on the falling edge of the SPI
clock
R/W 0
7
6
Invert SPI
CLK
Shift out MS
bit first
If 1 the 'idle' clock line state is high.
If 0 the 'idle' clock line state is low.
If 1 the data is shifted out starting with the MS bit.
(bit 15 or bit 11)
R/W 0
R/W 0
If 0 the data is shifted out starting with the LS bit. (bit
0)
5:0 Shift length Specifies the number of bits to shift
R/W 0
This field is ignored when using 'variable shift' mode
Invert SPI CLK
Changing this bit will immediately change the polarity of the SPI clock output. It is
recommended not to do this when also the CS is active as the connected devices will see this
as a clock change.
DOUT hold time
Because the interface runs of fast silicon the MOSI hold time against the clock will be very
short. This can cause considerable problems on SPI slaves. To make it easier for the slave to
see the data the hold time of the MOSI out against the SPI clock out is programmable.
CLK
CLK
MOSI
No hold time
MOSI
With hold time
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. 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.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 23
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 remain asserted and after a full bit time the last data bit is picked up. The
following figure shows this behaviour:
Clk
Cs_n
Get first bit Get last bit
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.
The AUXSPIx_CNTL1 registers control more features of the SPI interfaces.
Bit(s) Field Name Description Type Reset
31:18
10:8
7
- Reserved, write zero, read as don’t care
CS high time Additional SPI clock cycles where the CS is high. R/W 0
TX empty IRQ
If 1 the interrupt line is high when the transmit FIFO
R/W 0
is empty
6
5:2
1
Done IRQ If 1 the interrupt line is high when the interface is idle R/W 0
- Reserved, write zero, read as don’t care
Shift in MS bit
first
If 1 the data is shifted in starting with the MS bit. (bit
15)
R/W 0
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
R/W 0
new 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 make that the input shift register is not 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).
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 24
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).
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 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 or "receive FIFO overflow" flag as the number of entries received can never
be more then the number of entries transmitted.
AUX is IDLE:
This interrupt will be asserted when the module has finished all activities, including waiting
the minimum CS high time. This guarantees that any receive data will be available and
`transparent' changes can be made to the configuration register (e.g. inverting the SPI clock
polarity).
AUXSPI0/1_STAT Register (0x7E21 5088,0x7E21 50C8)
YNOPSIS
The AUXSPIx_STAT registers show the status of the SPI interfaces.
Bit(s) Field Name Description Type Reset
31:24
23:12
11:5
4
TX FIFO level The number of data units in the transmit data FIFO R/W 0
RX FIFO level The number of data units in the receive data FIFO. R/W 0
- Reserved, write zero, read as don’t care
TX Full If 1 the transmit FIFO is full
R/W 0
If 0 the transmit FIFO can accept at least 1 data unit.
3
TX Empty If 1 the transmit FIFO is empty
R/W 0
If 0 the transmit FIFO holds at least 1 data unit.
2
RX Empty If 1 the receiver FIFO is empty
R/W 0
If 0 the receiver FIFO holds at least 1 data unit.
6
Busy Indicates the module is busy transferring data. R/W 0
5:0 Bit count
The number of bits still to be processed. Starts with
R/W 0
'shift-length' and counts down.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 25
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.
AUXSPI0/1_PEEK Register (0x7E21 508C,0x7E21 50CC)
YNOPSIS
The AUXSPIx_PEEK registers show received data of the SPI interfaces.
Bit(s) Field Name Description Type Reset
31:16
15:0 Data
- Reserved, write zero, read as don’t care
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.
AUXSPI0/1_IO Register
(0x7E21 50A0-0x7E21 50AC
0x7E21 50E0-0x7E21 50EC)
YNOPSIS
The AUXSPIx_IO 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
Bit(s) Field Name Description Type Reset
31:16
- Reserved, write zero, read as don’t care
15:0 Data
Writes to this address range end up in the transmit
FIFO. Data is lost when writing whilst the transmit
FIFO is full.
Reads from this address will take the top entry from
the receive FIFO. Reading whilst the receive FIFO is
will return the last data received.
R/W 0
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 26
The Broadcom Serial Controller (BSC) controller is a master, fast-mode (400Kb/s) BSC
controller. The Broadcom Serial Control bus is a proprietary bus compliant with the Philips®
I2C bus/interface version 2.1 January 2000.
• I2C single master only operation (supports clock stretching wait states)
• Both 7-bit and 10-bit addressing is supported.
• Timing completely software controllable via registers
3.2 Register View
The BSC controller has eight memory-mapped registers. All accesses are assumed to be 32bit. Note that the BSC2 master is used dedicated with the HDMI interface and should not be
accessed by user programs.
There are three BSC masters inside BCM. The register addresses starts from
• BSC0: 0x7E20_5000
• BSC1: 0x7E80_4000
• BSC2 : 0x7E80_5000
The table below shows the address of I2C interface where the address is an offset from one of
the three base addreses listed above.
I2C Address Map
Offset
0x0
0x4
0x8
0xc
Register NameDescriptionSize
Control 32
Status 32
Data Length 32
Slave Address 32
0x10
0x14
0x18
Data FIFO 32
Clock Divider 32
Data Delay 32
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 28
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 has 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 RX 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.
31:16
15 I2CEN I2C Enable
RW 0x0
0 = BSC controller is disabled
1 = BSC controller is enabled
14:11
10 INTR INTR Interrupt on RX
RW 0x0
0 = Don t generate interrupts on RXR condition.
1 = Generate interrupt while RXR = 1.
9 INTT INTT Interrupt on TX
RW 0x0
0 = Don t generate interrupts on TXW condition.
1 = Generate interrupt while TXW = 1.
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 29
0 = Don t generate interrupts on DONE
condition. 1 = Generate interrupt while DONE =
1.
RW 0x0
7 ST ST Start Transfer
0 = No action. 1 = Start a new transfer. One shot
operation. Read back as 0.
6
5:4 CLEAR CLEAR FIFO Clear
00 = No action. x1 = Clear FIFO. One shot
operation. 1x = Clear FIFO. One shot operation.
If CLEAR and ST are both set in the same
operation, the FIFO is cleared before the new
frame is started. Read back as 0.
Note: 2 bits are used to maintain compatibility to
previous version.