196
32059L–AVR32–01/2012
AT32UC3B
18.5 Signal Description
18.6 Product Dependencies
18.6.1
I/O Lines
The pins used for interfacing the compliant external devices may be multiplexed with GPIO lines.
The programmer must first program the GPIO controller to assign the SPI pins to their peripheral
functions.To use the local loopback function the SPI pins must be controlled by the SPI.
18.6.2
Power Management
The SPI may be clocked through the Power Manager, Before using the SPI, the programmer
must ensure that the SPI clock is enabled in the Power Manager.
In the SPI description, CLK_SPI is the clock of the peripheral bus to which the SPI is connected.
18.6.3
Interrupt
The SPI interface has an interrupt line connected to the Interrupt Controller (INTC). Handling the
SPI interrupt requires programming the INTC before configuring the SPI.
18.7 Functional Description
18.7.1
Modes of Operation
The SPI operates in Master Mode or in Slave Mode.
Operation in Master Mode is programmed by writing at 1 the MSTR bit in the Mode Register.
The pins NPCS0 to NPCS3 are all configured as outputs, the SPCK pin is driven, the MISO line
is wired on the receiver input and the MOSI line driven as an output by the transmitter.
If the MSTR bit is written at 0, the SPI operates in Slave Mode. The MISO line is driven by the
transmitter output, the MOSI line is wired on the receiver input, the SPCK pin is driven by the
transmitter to synchronize the receiver. The NPCS0 pin becomes an input, and is used as a
Slave Select signal (NSS). The pins NPCS1 to NPCS3 are not driven and can be used for other
purposes.
The data transfers are identically programmable for both modes of operations. The baud rate
generator is activated only in Master Mode.
18.7.2
Data Transfer
Four combinations of polarity and phase are available for data transfers. The clock polarity is
programmed with the CPOL bit in the Chip Select Register. The clock phase is programmed with
Table 18-1.
Pin Name
Pin Description
Type
Master
Slave
MISO
Master In Slave Out
Input
Output
MOSI
Master Out Slave In
Output
Input
SPCK
Serial Clock
Output
Input
NPCS1-NPCS3
Peripheral Chip Selects
Output
Unused
NPCS0/NSS
Peripheral Chip Select/Slave Select
Output
Input