12.3. SPI
Arm Documentation
Excerpted from the ARM PrimeCell Synchronous Serial Port (PL022) Technical Reference Manual . Used with permission.
RP2350 has two identical SPI controllers, both based on an Arm Primecell Synchronous Serial Port (SSP) (PL022) (Revision r1p4). This is distinct from the QSPI memory interface covered in Section 12.14 .
Each controller supports the following features:
- • Master or Slave modes
- ◦ Motorola SPI-compatible interface
- ◦ Texas Instruments synchronous serial interface
- ◦ National Semiconductor Microwire interface
- • 8-location TX and RX FIFOs
- • Interrupt generation to service FIFOs or indicate error conditions
- • Can be driven from DMA
- • Programmable clock rate
- • Programmable data size 4-16 bits
Each controller can be connected to a number of GPIO pins as defined in the Bank 0 GPIO function table, Table 646 ( Section 9.4 ).
The entries in the GPIO function table, such as "SPI0 TX", specify the SPI instance and the SPI signal for that instance which are available on that GPIO. The signals in the table are described as:
SCK
Serial clock. Connects to the SPI peripheral clock signals described as SSPCLKOUT and SSPCLKIN in the following sections. These pins are inputs in slave mode, and outputs in master mode.
TX
Serial data output. Connects to the SPI peripheral SSPTXD (data out) and nSSPOE (output enable) signals described in the following sections. This is always a data output, independent of the bus role. The SPI peripheral controls tristating depending on chip select status.
RX
Serial data input. Connects to the SPI peripheral SSPRXD data input described in the following sections. This is always a data input, independent of the bus role.
CSn
Active-low chip select. Connects to the SPI peripheral signals SSPFSSOUT and SSPFSSIN described in the following sections. These pins are inputs in slave mode, and outputs in master mode.
The SPI uses clk_peri as its reference clock for SPI timing, and is referred to as SSPCLK in the following sections. clk_sys is used as the bus clock, and is referred to as PCLK in the following sections (also see Figure 33 ).
12.3.1. Changes from RP2040
The output enable of the SSPTXD data output (connecting to pins listed as SPI0 TX and SPI1 TX in the GPIO function tables) is controlled by the SPI peripheral nSSP0E signal. The peripheral automatically tristates its output when deselected in slave mode. This makes software control of the output enable unnecessary even when multiple slaves share the data lines.
12.3.2. Overview
The PrimeCell SSP is a master or slave interface for synchronous serial communication with peripheral devices that have Motorola SPI, National Semiconductor Microwire, or Texas Instruments synchronous serial interfaces.
The PrimeCell SSP performs serial-to-parallel conversion on data received from a peripheral device. The CPU accesses data, control, and status information through the AMBA APB interface. The transmit and receive paths are buffered with internal FIFO memories, enabling up to eight 16-bit values to be stored independently in both transmit and receive modes. Serial data transmits on SSPTXD and is received on SSPRXD .
The PrimeCell SSP includes a programmable bit rate clock divider and prescaler to generate the serial output clock, SSPCLKOUT , from the input clock, SSPCLK . Bit rates are supported to 2MHz and higher, subject to choice of frequency for SSPCLK , and the maximum bit rate is determined by peripheral devices.
You can use the control registers SSPCR0 and SSPCR1 to program the PrimeCell SSP operating mode, frame format, and size.
The following individually maskable interrupts are generated:
- • SSPTXINTR requests servicing of the transmit buffer
- • SSPRXINTR requests servicing of the receive buffer
- • SSPRORINTR indicates an overrun condition in the receive FIFO
- • SSPRTINTR indicates that a timeout period expired while data was present in the receive FIFO.
A single combined interrupt is asserted if any of the individual interrupts are asserted and unmasked. This interrupt is connected to the processor interrupt controllers in RP2350.
In addition to the above interrupts, a set of DMA signals are provided for interfacing with a DMA controller.
Depending on the operating mode selected, the SSPFSSOUT output operates as:
- • an active-HIGH frame synchronization output for Texas Instruments synchronous serial frame format
- • an active-LOW slave select for SPI and Microwire.
12.3.3. Functional description
Figure 91. PrimeCell SSP block diagram.
For clarity, does not show the test logic.
![Figure 91: PrimeCell SSP block diagram. This block diagram illustrates the internal architecture of the PrimeCell SSP (Serial Peripheral Interface) block. It shows the connection between the AMBA APB interface, the Register block, the DMA interface, and the Transmit and receive logic. The AMBA APB interface handles control signals like PRESETn, PSEL, PENABLE, PWRITE, PADDR[11:2], PWDATA[15:0], PRDATA[15:0], and PCLK. It connects to the Register block, which stores data and provides a Prescale value to the Clock prescaler. The Register block also interfaces with the DMA interface via SSPrxDMACLR, SSPTxDMACLR, SSPrxDMASREQ, SSPrxDMABREQ, SSPTxDMASREQ, and SSPTxDMABREQ. The Clock prescaler takes PCLK and the Prescale value to generate SSPCLK. The SSPCLK is then divided by the Transmit and receive logic to produce nSSPOE, SSPTXD, SSPrFSSOUT, SSPrCLKOUT, nSSPrCTL0E, SSPrCLKIN, SSPrFSSIN, and SSPrXRD. The Transmit and receive logic also handles Tx/Rx FIFO watermark levels and Tx/Rx params. The SSP block includes a Tx FIFO (16 bits wide, 8 locations deep) and an Rx FIFO (16 bits wide, 8 locations deep). The Tx FIFO outputs SSPTXINTR and TxRdDataIn[15:0]. The Rx FIFO outputs SSPrXINTR, SSPrRORINTR, SSPrRTINTR, and RxWrData[15:0]. The FIFO status and interrupt generation block outputs SSPrINTR, SSPrRINTR, and SSPrXINTR. The SSP block also outputs SSPrXINTR, SSPrRINTR, SSPrXINTR, SSPrRINTR, SSPrXINTR, and SSPrRINTR.](/RP235x/bddd95137ca3e224394480a84a2d5eac_img.jpg)
12.3.3.1. AMBA APB interface
The AMBA APB interface generates read and write decodes for accesses to status and control registers, and transmit and receive FIFO memories.
12.3.3.2. Register block
The register block stores data written, or to be read, across the AMBA APB interface.
12.3.3.3. Clock prescaler
When configured as a master, an internal prescaler, comprising two free-running reloadable serially linked counters, provides the serial output clock SSPCLKOUT .
You can program the clock prescaler, using the SSPCPSR register, to divide SSPCLK by a factor of 2-254 in steps of two. By not utilizing the least significant bit of the SSPCPSR register, division by an odd number is not possible; this ensures that a symmetrical clock with equal mark-space ratio is generated. See SSPCPSR .
The output of the prescaler is divided again by a factor of 1-256, by programming the SSPCR0 control register, to give the final master output clock SSPCLKOUT .
i NOTE
The PCLK and SSPCLK clock inputs in Figure 91 are connected to the clk_sys and clk_peri system-level clock nets on RP2350, respectively. By default, clk_peri attaches directly to the system clock. However, you can detach it to maintain constant SPI frequency if the system clock is varied dynamically. See Figure 33 for an overview of the RP2350 clock architecture.
12.3.3.4. Transmit FIFO
The common transmit (TX) FIFO is a 16-bit wide, 8-location deep memory buffer. CPU data written across the AMBA
APB interface is stored in the buffer until read out by the transmit logic.
When configured as a master or a slave, parallel data is written into the transmit FIFO prior to serial conversion, and transmission to the attached slave or master respectively, through the SSPTXD pin.
12.3.3.5. Receive FIFO
The common receive (RX) FIFO is a 16-bit wide, 8-location deep memory buffer. Received data from the serial interface is stored in the buffer until read out by the CPU across the AMBA APB interface.
When configured as a master or slave, serial data received through the SSPRXD pin is registered prior to parallel loading into the attached slave or master receive FIFO respectively.
12.3.3.6. Transmit and receive logic
When configured as a master, the clock for the attached slaves is derived from a divided-down version of SSPCLK through the previously described prescaler operations. The master transmit logic successively reads a value from its transmit FIFO and performs parallel to serial conversion on it. Then, the serial data stream and frame control signal, synchronized to SSPCLKOUT , outputs through the SSPTXD pin to the attached slaves. The master receive logic performs serial to parallel conversion on the incoming synchronous SSPRXD data stream, extracting and storing values into its receive FIFO for subsequent reading through the APB interface.
When configured as a slave, the SSPCLKIN clock is provided by an attached master and used to time transmission and reception sequences. The slave transmit logic, under control of the master clock, successively:
- 1. Reads a value from its transmit FIFO.
- 2. Performs parallel to serial conversion.
- 3. Outputs the serial data stream and frame control signal through the slave SSPTXD pin.
The slave receive logic performs serial to parallel conversion on the incoming SSPRXD data stream, extracting and storing values into its receive FIFO, for subsequent reading through the APB interface.
12.3.3.7. Interrupt generation logic
The PrimeCell SSP generates four individual maskable, active-HIGH interrupts. A combined interrupt output is generated as an OR function of the individual interrupt requests.
The transmit and receive dynamic data-flow interrupts, SSPTXINTR and SSPRXINTR , are separated from the status interrupts so that data can be read or written in response to the FIFO trigger levels.
12.3.3.8. DMA interface
The PrimeCell SSP provides an interface to connect to a DMA controller, see Section 12.3.4.16 .
12.3.3.9. Synchronizing registers and logic
The PrimeCell SSP supports both asynchronous and synchronous operation of the clocks, PCLK and SSPCLK . Synchronization registers and handshaking logic have been implemented, and are active at all times. Synchronization of control signals is performed on both directions of data flow, that is:
- • from the PCLK to the SSPCLK domain
- • from the SSPCLK to the PCLK domain.
12.3.4. Operation
12.3.4.1. Interface reset
The PrimeCell SSP is reset by the global reset signal, \( \overline{\text{PRESETn}} \) , and a block-specific reset signal, \( \text{nSSPRST} \) . The device reset controller asserts \( \text{nSSPRST} \) asynchronously and negates it synchronously to \( \text{SSPCLK} \) .
12.3.4.2. Configuring the SSP
Following reset, the PrimeCell SSP logic is disabled and must be configured when in this state. It is necessary to program control registers \( \text{SSPCR0} \) and \( \text{SSPCR1} \) to configure the peripheral as a master or slave operating under one of the following protocols:
- • Motorola SPI
- • Texas Instruments SSI
- • National Semiconductor
The bit rate, derived from the external \( \text{SSPCLK} \) , requires the programming of the clock prescale register \( \text{SSPCPSR} \) .
12.3.4.3. Enable PrimeCell SSP operation
You can either prime the transmit FIFO, by writing up to eight 16-bit values when the PrimeCell SSP is disabled, or permit the transmit FIFO service request to interrupt the CPU. Once enabled, transmission or reception of data begins on the transmit, \( \text{SSPTXD} \) , and receive, \( \text{SSPRXD} \) , pins.
12.3.4.4. Clock ratios
There is a constraint on the ratio of the frequencies of \( \text{PCLK} \) to \( \text{SSPCLK} \) . The frequency of \( \text{SSPCLK} \) must be less than or equal to that of \( \text{PCLK} \) . This ensures that control signals from the \( \text{SSPCLK} \) domain to the \( \text{PCLK} \) domain are guaranteed to get synchronized before one frame duration:
In the slave mode of operation, the \( \text{SSPCLKIN} \) signal from the external master is double-synchronized and then delayed to detect an edge. It takes three \( \text{SSPCLKs} \) to detect an edge on \( \text{SSPCLKIN} \) . \( \text{SSPTXD} \) has less setup time to the falling edge of \( \text{SSPCLKIN} \) on which the master is sampling the line.
The setup and hold times on \( \text{SSPRXD} \) , with reference to \( \text{SSPCLKIN} \) , must be more conservative to ensure that it is at the right value when the actual sampling occurs within the \( \text{SSPMS} \) . To ensure correct device operation, \( \text{SSPCLK} \) must be at least 12 times faster than the maximum expected frequency of \( \text{SSPCLKIN} \) .
The frequency selected for \( \text{SSPCLK} \) must accommodate the desired range of bit clock rates. The ratio of minimum \( \text{SSPCLK} \) frequency to \( \text{SSPCLKOUT} \) maximum frequency in the case of the slave mode is 12, and for the master mode, it is two.
For example, at the maximum \( \text{SSPCLK} \) ( \( \text{clk\_peri} \) ) frequency on RP2350 of 150MHz, the maximum peak bit rate in master mode is 70.5Mb/s. This is achieved with the \( \text{SSPCPSR} \) register programmed with a value of 2, and the \( \text{SCR}[7:0] \) field in the \( \text{SSPCR0} \) register programmed with a value of 0.
In slave mode, the same maximum \( \text{SSPCLK} \) frequency of 150MHz can achieve a peak bit rate of \( 150 / 12 = 12.5\text{Mb/s} \) . The \( \text{SSPCPSR} \) register can be programmed with a value of 12, and the \( \text{SCR}[7:0] \) field in the \( \text{SSPCR0} \) register can be programmed with a value of 0. Similarly, the ratio of \( \text{SSPCLK} \) maximum frequency to \( \text{SSPCLKOUT} \) minimum frequency is \( 254 \times 256 \) .
The minimum frequency of \( \text{SSPCLK} \) is governed by the following inequalities, both of which must be satisfied:
\( F_{SSPCLK}(min) \geq 12 \times F_{SSPCLKIN}(max) \) , for slave mode.
The maximum frequency of SSPCLK is governed by the following inequalities, both of which must be satisfied:
\( F_{SSPCLK}(max) \leq 254 \times 256 \times F_{SSPCLKOUT}(min) \) , for master mode
\( F_{SSPCLK}(max) \leq 254 \times 256 \times F_{SSPCLKIN}(min) \) , for slave mode.
12.3.4.5. Programming the SSPCR0 control register
The SSPCR0 register is used to:
- • program the serial clock rate
- • select one of the three protocols
- • select the data word size, where applicable.
The Serial Clock Rate (SCR) value, in conjunction with the SSPCPSR clock prescale divisor value, CPSDVSR , is used to derive the PrimeCell SSP transmit and receive bit rate from the external SSPCLK .
The frame format is programmed through the FRF bits, and the data word size through the DSS bits.
Bit phase and polarity, applicable to Motorola SPI format only, are programmed through the SPH and SP0 bits.
12.3.4.6. Programming the SSPCR1 control register
The SSPCR1 register is used to:
- • select master or slave mode
- • enable a loop back test feature
- • enable the PrimeCell SSP peripheral.
To configure the PrimeCell SSP as a master, clear the SSPCR1 register master or slave selection bit, MS, to 0. This is the default value on reset.
Setting the SSPCR1 register MS bit to 1 configures the PrimeCell SSP as a slave. When configured as a slave, use the SSPCR1 slave mode SSPTXD output disable bit ( SOD ) to enable or disable of the PrimeCell SSP SSPTXD signal. You can use this in some multi-slave environments where masters might parallel broadcast.
To enable the PrimeCell SSP, set the Synchronous Serial Port Enable ( SSE ) bit to 1.
12.3.4.6.1. Bit rate generation
The serial bit rate is derived by dividing down the input clock, SSPCLK . The clock is first divided by an even prescale value CPSDVSR in the range 2-254, and is programmed in SSPCPSR . The clock is divided again by a value in the range 1-256, that is \( 1 + SCR \) , where SCR is the value programmed in SSPCR0 .
The following equation defines the frequency of the output signal bit clock, SSPCLKOUT :
For example, if SSPCLK is 125MHz, and CPSDVSR = 2, then SSPCLKOUT has a frequency range from 244kHz - 62.5MHz.
12.3.4.7. Frame format
Each data frame is between 4-16 bits long, depending on the size of data programmed, and is transmitted starting with the MSB. You can select the following basic frame types:
- • Texas Instruments synchronous serial
- • Motorola SPI
- • National Semiconductor Microwire.
For all formats, the serial clock, SSPCLKOUT , is held inactive while the PrimeCell SSP is idle, and transitions at the programmed frequency only during active transmission or reception of data. The idle state of SSPCLKOUT is utilized to provide a receive timeout indication that occurs when the receive FIFO still contains data after a timeout period.
For Motorola SPI and National Semiconductor Microwire frame formats, the serial frame, SSPFSSOUT , pin is active-LOW, and is asserted, pulled-down, during the entire transmission of the frame.
For Texas Instruments synchronous serial frame format, the SSPFSSOUT pin is pulsed for one serial clock period, starting at its rising edge, prior to the transmission of each frame. For this frame format, both the PrimeCell SSP and the off-chip slave device drive their output data on the rising edge of SSPCLKOUT , and latch data from the other device on the falling edge.
Unlike the full-duplex transmission of the other two frame formats, the National Semiconductor Microwire format uses a special master-slave messaging technique that operates at half-duplex. In this mode, when a frame begins, an 8-bit control message is transmitted to the off-chip slave. During this transmit, the SSS receives no incoming data. After the message has been sent, the off-chip slave decodes it and, after waiting one serial clock after the last bit of the 8-bit control message has been sent, responds with the requested data. The returned data can be 4-16 bits in length, making the total frame length in the range 13-25 bits.
12.3.4.8. Texas Instruments synchronous serial frame format
Figure 92 shows the Texas Instruments synchronous serial frame format for a single transmitted frame.
Figure 92. Texas Instruments synchronous serial frame format, single transfer

The diagram shows four signals over time: SSPCLKOUT/SSPCLIN , SSPFSSOUT/SSPFSSIN , SSPTXD/SSPRXD , and nSSPOE . SSPCLKOUT/SSPCLIN is a periodic square wave. SSPFSSOUT/SSPFSSIN is a single pulse that occurs at the rising edge of the first clock cycle. SSPTXD/SSPRXD shows a data frame of 4 to 16 bits, with the first bit labeled MSB and the last bit labeled LSB . nSSPOE is a signal that is active-low, going low at the start of the frame and returning high after the frame is complete.
In this mode, SSPCLKOUT and SSPFSSOUT are forced LOW, and the transmit data line, SSPTXD is tristated whenever the PrimeCell SSP is idle. When the bottom entry of the transmit FIFO contains data, SSPFSSOUT is pulsed HIGH for one SSPCLKOUT period. The value to be transmitted is also transferred from the transmit FIFO to the serial shift register of the transmit logic. On the next rising edge of SSPCLKOUT , the MSB of the 4-bit to 16-bit data frame is shifted out on the SSPTXD pin. In a similar way, the MSB of the received data is shifted onto the SSPRXD pin by the off-chip serial slave device.
Both the PrimeCell SSP and the off-chip serial slave device then clock each data bit into their serial shifter on the falling edge of each SSPCLKOUT . The received data is transferred from the serial shifter to the receive FIFO on the first rising edge of CLK after the LSB has been latched.
Figure 93 shows the Texas Instruments synchronous serial frame format when back-to-back frames are transmitted.
Figure 93. Texas Instruments synchronous serial frame format, continuous transfer

The diagram shows four signals over time: SSPCLKOUT/SSPCLIN , SSPFSSOUT/SSPFSSIN , SSPTXD/SSPRXD , and nSSPOE (=0) . SSPCLKOUT/SSPCLIN is a periodic square wave. SSPFSSOUT/SSPFSSIN is a single pulse that occurs at the rising edge of the first clock cycle. SSPTXD/SSPRXD shows a data frame of 4 to 16 bits, with the first bit labeled MSB and the last bit labeled LSB . nSSPOE (=0) is a signal that is active-low, going low at the start of the frame and returning high after the frame is complete.
12.3.4.9. Motorola SPI frame format
The Motorola SPI interface is a four-wire interface where the SSPFSSOUT signal behaves as a slave select. The main feature of the Motorola SPI format is that you can program the inactive state and phase of the SSPCLKOUT signal using the SP0 and SPH bits of the SSPSCR0 control register.
12.3.4.9.1. SP0, clock polarity
When the SP0 clock polarity control bit is LOW, it produces a steady state LOW value on the SSPCLKOUT pin. If the SP0 clock polarity control bit is HIGH, a steady state HIGH value is placed on the SSPCLKOUT pin when data is not being transferred.
12.3.4.9.2. SPH, clock phase
The SPH control bit selects the clock edge that captures data and enables it to change state. It has the most impact on the first bit transmitted by either permitting or not permitting a clock transition before the first data capture edge.
When the SPH phase control bit is LOW, data is captured on the first clock edge transition.
When the SPH clock phase control bit is HIGH, data is captured on the second clock edge transition.
12.3.4.10. Motorola SPI format with SP0=0, SPH=0
Figure 94 and Figure 95 shows a continuous transmission signal sequence for Motorola SPI frame format with SP0=0 , SPH=0 . Figure 94 shows a single transmission signal sequence for Motorola SPI frame format with SP0=0 , SPH=0 .
Figure 94. Motorola SPI frame format, single transfer, with SP0=0 and SPH=0

Figure 95 shows a continuous transmission signal sequence for Motorola SPI frame format with SP0=0 , SPH=0 .
Figure 95. Motorola SPI frame format, single transfer, with SP0=0 and SPH=0

In this configuration, during idle periods:
- • the SSPCLKOUT signal is forced LOW
- • the SSPFSSOUT signal is forced HIGH
- • the transmit data line SSPTXD is arbitrarily forced LOW
- • the nSSPOE pad enable signal is forced HIGH (this is not connected to the pad in RP2350)
- • when the PrimeCell SSP is configured as a master, the nSSPCTL0E line is driven LOW, enabling the SSPCLKOUT pad, active-LOW enable
- • when the PrimeCell SSP is configured as a slave, the nSSPCTL0E line is driven HIGH, disabling the SSPCLKOUT pad, active-LOW enable
If the PrimeCell SSP is enable, and there is valid data within the transmit FIFO, the start of transmission is signified by the SSPFSSOUT master signal being driven LOW. This causes slave data to be enabled onto the SSPRXD input line of the master. The nSSPOE line is driven LOW, enabling the master SSPTXD output pad.
One-half SSPCLKOUT period later, valid master data is transferred to the SSPTXD pin. Now that both the master and slave data have been set, the SSPCLKOUT master clock pin goes HIGH after one additional half SSPCLKOUT period.
The data is now captured on the rising and propagated on the falling edges of the SSPCLKOUT signal.
In the case of a single word transmission, after all bits of the data word have been transferred, the SSPFSSOUT line is returned to its idle HIGH state one SSPCLKOUT period after the last bit has been captured.
However, in the case of continuous back-to-back transmissions, the SSPFSSOUT signal pulse HIGH between each data word transfer. This is because the slave select pin freezes the data in its serial peripheral register and does not permit it to be altered if the SPH bit is logic zero. Therefore, the master device must raise the SSPFSSIN pin of the slave device between each data transfer to enable the serial peripheral data write. On completion of the continuous transfer, the SSPFSSOUT pin is returned to its idle state one SSPCLKOUT period after the last bit has been captured.
12.3.4.11. Motorola SPI format with SPO=0, SPH=1
Figure 96 shows the transfer signal sequence for Motorola SPI format with SPO=0 , SPH=1 , and it covers both single and continuous transfers.
Figure 96. Motorola SPI frame format with SPO=0 and SPH=1, single and continuous transfers

In this configuration, during idle periods:
- the SSPCLKOUT signal is forced LOW
- The SSPFSSOUT signal is forced HIGH
- the transmit data line SSPTXD is arbitrarily forced LOW
- the nSSPOE pad enable signal is forced HIGH (not connected to the pad in RP2350)
- when the PrimeCell SSP is configured as a master, the nSSPCTL0E line is driven LOW, enabling the SSPCLKOUT pad, active-LOW enable
- when the PrimeCell SSP is configured as a slave, the nSSPCTL0E line is driven HIGH, disabling the SSPCLKOUT pad, active-LOW enable
If the PrimeCell SSP is enabled, and there is valid data within the transmit FIFO, the start of transmission is signified by the SSPFSSOUT master signal being driven LOW. The nSSPOE line is driven LOW, enabling the master SSPTXD output pad. After an additional one half SSPCLKOUT period, both master and slave valid data is enabled onto their respective transmission lines. At the same time, the SSPCLKOUT is enabled with a rising edge transition.
Data is then captured on the falling edges and propagated on the rising edges of the SSPCLKOUT signal.
In the case of a single word transfer, after all bits have been transferred, the SSPFSSOUT line is returned to its idle HIGH state one SSPCLKOUT period after the last bit has been captured. For continuous back-to-back transfers, the SSPFSSOUT pin is held LOW between successive data words and termination is the same as that of the single word transfer.
12.3.4.12. Motorola SPI format with SPO=1, SPH=0
Figure 97 and Figure 98 show single and continuous transmission signal sequences for Motorola SPI format with SPO=1, SPH=0.
Figure 97 shows a single transmission signal sequence for Motorola SPI format with SPO=1, SPH=0.
Figure 97. Motorola SPI frame format, single transfer, with SPO=1 and SPH=0

Figure 98 shows a continuous transmission signal sequence for Motorola SPI format with SPO=1, SPH=0.
i NOTE
In Figure 97, Q is an undefined signal.
Figure 98. Motorola SPI frame format, continuous transfer, with SPO=1 and SPH=0

In this configuration, during idle periods:
- • the SSPCLKOUT signal is forced HIGH
- • the SSPFSSOUT signal is forced HIGH
- • the transmit data line SSPTXD is arbitrarily forced LOW
- • the nSSPOE pad enable signal is forced HIGH (not connected to the pad in RP2350)
- • when the PrimeCell SSP is configured as a master, the nSSPCTL0E line is driven LOW, enabling the SSPCLKOUT pad, active-LOW enable
- • when the PrimeCell SSP is configured as a slave, the nSSPCTL0E line is driven HIGH, disabling the SSPCLKOUT pad, active-LOW enable
If the PrimeCell SSP is enabled, and there is valid data within the transmit FIFO, the start of transmission is signified by the SSPFSSOUT master signal being driven LOW, and this causes slave data to be immediately transferred onto the SSPRXD line of the master. The nSSPOE line is driven LOW, enabling the master SSPTXD output pad.
One half period later, valid master data is transferred to the SSPTXD line. Now that both the master and slave data have been set, the SSPCLKOUT master clock pin becomes LOW after one additional half SSPCLKOUT period. This means that data is captured on the falling edges and be propagated on the rising edges of the SSPCLKOUT signal.
In the case of a single word transmission, after all bits of the data word are transferred, the SSPFSSOUT line is returned to its idle HIGH state one SSPCLKOUT period after the last bit has been captured.
However, in the case of continuous back-to-back transmissions, the SSPFSSOUT signal must be pulsed HIGH between each data word transfer. This is because the slave select pin freezes the data in its serial peripheral register and does not permit it to be altered if the SPH bit is logic zero. Therefore, the master device must raise the SSPFSSIN pin of the slave device between each data transfer to enable the serial peripheral data write. On completion of the continuous transfer, the SSPFSSOUT pin is returned to its idle state one SSPCLKOUT period after the last bit has been captured.
12.3.4.13. Motorola SPI format with SPO=1, SPH=1
Figure 99 shows the transfer signal sequence for Motorola SPI format with SPO=1, SPH=1, and it covers both single and continuous transfers.
Figure 99. Motorola SPI frame format with SPO=1 and SPH=1, single and continuous transfers

NOTE
In Figure 99, Q is an undefined signal.
In this configuration, during idle periods:
- • the SSPCLKOUT signal is forced HIGH
- • the SSPFSSOUT signal is forced HIGH
- • the transmit data line SSPTXD is arbitrarily forced LOW
- • the nSSPOE pad enable signal is forced HIGH (not connected to the pad in RP2350)
- • when the PrimeCell SSP is configured as a master, the nSSPCTL0E line is driven LOW, enabling the SSPCLKOUT pad, active-LOW enable
- • when the PrimeCell SSP is configured as a slave, the nSSPCTL0E line is driven HIGH, disabling the SSPCLKOUT pad, active-LOW enable.
If the PrimeCell SSP is enabled, and there is valid data within the transmit FIFO, the start of transmission is signified by the SSPFSSOUT master signal being driven LOW. The nSSPOE line is driven LOW, enabling the master SSPTXD output pad. After an additional one half SSPCLKOUT period, both master and slave data are enabled onto their respective transmission lines. At the same time, the SSPCLKOUT is enabled with a falling edge transition. Data is then captured on the rising edges and propagated on the falling edges of the SSPCLKOUT signal.
After all bits have been transferred, in the case of a single word transmission, the SSPFSSOUT line is returned to its idle HIGH state one SSPCLKOUT period after the last bit has been captured.
For continuous back-to-back transmissions, the SSPFSSOUT pin remains in its active-LOW state, until the final bit of the last word has been captured, and then returns to its idle state as the previous section describes.
For continuous back-to-back transfers, the SSPFSSOUT pin is held LOW between successive data words and termination is the same as that of the single word transfer.
12.3.4.14. National Semiconductor Microwire frame format
Figure 100 shows the National Semiconductor Microwire frame format for a single frame. Figure 101 shows the same format when back to back frames are transmitted.
Figure 100. Microwire frame format, single transfer

Microwire format is very similar to SPI format, except that transmission is half-duplex instead of full-duplex, using a master-slave message passing technique. Each serial transmission begins with an 8-bit control word that is transmitted from the PrimeCell SSP to the off-chip slave device. During this transmission, the PrimeCell SSP receives no incoming data. After the message has been sent, the off-chip slave decodes it and, after waiting one serial clock after the last bit of the 8-bit control message has been sent, responds with the required data. The returned data is 4 to 16 bits in length, making the total frame length in the range 13-25 bits.
In this configuration, during idle periods:
- • SSPCLKOUT is forced LOW
- • SSPFSSOUT is forced HIGH
- • the transmit data line, SSPTXD , is arbitrarily forced LOW
- • the nSSPOE pad enable signal is forced HIGH (not connected to the pad in RP2350)
A transmission is triggered by writing a control byte to the transmit FIFO. The falling edge of SSPFSSOUT causes the value contained in the bottom entry of the transmit FIFO to be transferred to the serial shift register of the transmit logic, and the MSB of the 8-bit control frame to be shifted out onto the SSPTXD pin. SSPFSSOUT remains LOW for the duration of the frame transmission. The SSPRXD pin remains tristated during this transmission.
The off-chip serial slave device latches each control bit into its serial shifter on the rising edge of each SSPCLKOUT . After the last bit is latched by the slave device, the control byte is decoded during a one clock wait-state, and the slave responds by transmitting data back to the PrimeCell SSP. Each bit is driven onto SSPRXD line on the falling edge of SSPCLKOUT . The PrimeCell SSP in turn latches each bit on the rising edge of SSPCLKOUT . At the end of the frame, for single transfers, the SSPFSSOUT signal is pulled HIGH one clock period after the last bit has been latched in the receive serial shifter, that causes the data to be transferred to the receive FIFO.
NOTE
The off-chip slave device can tristate the receive line either on the falling edge of SSPCLKOUT after the LSB has been latched by the receive shifter, or when the SSPFSSOUT pin goes HIGH.
For continuous transfers, data transmission begins and ends in the same manner as a single transfer. However, the SSPFSSOUT line is continuously asserted, held LOW, and transmission of data occurs back-to-back. The control byte of the next frame follows directly after the LSB of the received data from the current frame. Each of the received values is transferred from the receive shifter on the falling edge SSPCLKOUT , after the LSB of the frame has been latched into the PrimeCell SSP.
Figure 101 shows the National Semiconductor Microwire frame format when back-to-back frames are transmitted.
Figure 101. Microwire frame format, continuous transfers

In Microwire mode, the PrimeCell SSP slave samples the first bit of receive data on the rising edge of SSPCLKIN after SSPFSSIN has gone LOW. Masters that drive a free-running SSPCLKIN must ensure that the SSPFSSIN signal has sufficient setup and hold margins with respect to the rising edge of SSPCLKIN .
Figure 102 shows these setup and hold time requirements.
Figure 104. PrimeCell SSP master coupled to an SPI slave

Figure 105 shows a Motorola SPI configured as a master and interfaced to an instance of a PrimeCell SSP (PL022) configured as a slave. In this case, the slave Select Signal ( \( \overline{SS} \) ) is permanently tied HIGH to configure it as a master. The master can broadcast to the slave through the master SPI MOSI line and in response, the slave drives its nSSPOE signal LOW. This enables its SSPTXD data onto the MISO line of the master.
Figure 105. SPI master coupled to a PrimeCell SSP slave

12.3.4.16. PrimeCell DMA interface
The PrimeCell SSP provides an interface to connect to the DMA controller. The PrimeCell SSP DMA control register, SSPDMACR controls the DMA operation of the PrimeCell SSP.
The DMA interface includes the following signals, for receive:
SSPRXDMASREQ
Single-character DMA transfer request, asserted by the SSP. This signal is asserted when the receive FIFO contains at least one character.
SSPRXDMABREQ
Burst DMA transfer request, asserted by the SSP. This signal is asserted when the receive FIFO contains four or more characters.
SSPRXDACLK
DMA request clear, asserted by the DMA controller to clear the receive request signals. If DMA burst transfer is requested, the clear signal is asserted during the transfer of the last data in the burst.
The DMA interface includes the following signals, for transmit:
SSPTXDMASREQ
Single-character DMA transfer request, asserted by the SSP. This signal is asserted when there is at least one empty location in the transmit FIFO.
SSPTXDMABREQ
Burst DMA transfer request, asserted by the SSP. This signal is asserted when the transmit FIFO contains four characters or fewer.
SSPTXDMACLR
DMA request clear, asserted by the DMA controller, to clear the transmit request signals. If a DMA burst transfer is requested, the clear signal is asserted during the transfer of the last data in the burst.
The burst transfer and single transfer request signals are not mutually exclusive. They can both be asserted at the same time. For example, when there is more data than the watermark level of four in the receive FIFO, the burst transfer request, and the single transfer request, are asserted. When the amount of data left in the receive FIFO is less than the watermark level, the single request only is asserted. This is useful for situations where the number of characters left to be received in the stream is less than a burst.
For example, if 19 characters must be received, the DMA controller then transfers four bursts of four characters, and three single transfers to complete the stream.
NOTE
For the remaining three characters, the PrimeCell SSP does not assert the burst request.
Each request signal remains asserted until the relevant DMA clear signal is asserted. After the request clear signal is de-asserted, a request signal can become active again, depending on the conditions that previous sections describe. All request signals are de-asserted if the PrimeCell SSP is disabled, or the DMA enable signal is cleared.
Table 1098 shows the trigger points for DMABREQ, for both the transmit and receive FIFOs.
Table 1098. DMA trigger points for the transmit and receive FIFOs
| Burst length | ||
|---|---|---|
| Watermark level | Transmit, number of empty locations | Receive, number of filled locations |
| 1/2 | 4 | 4 |
Figure 106 shows the timing diagram for both a single transfer request, and a burst transfer request, with the appropriate DMA clear signal. The signals are all synchronous to PCLK.
Figure 106. DMA transfer waveforms

The diagram shows four digital signals over time, synchronized to a PCLK clock. PCLK is a periodic square wave. DMASREQ (single transfer request) is asserted (goes high) at the start of a PCLK cycle and remains high until the end of the cycle. DMABREQ (burst transfer request) is asserted at the start of a PCLK cycle and remains high for multiple cycles. DMACLR (DMA request clear) is asserted at the end of a PCLK cycle and remains high for multiple cycles, clearing the DMASREQ and DMABREQ signals.
12.3.5. List of registers
The SPI0 and SPI1 registers start at base addresses of 0x40080000 and 0x40088000 respectively (defined as SPI0_BASE and SPI1_BASE in SDK).
Table 1099. List of SPI registers
| Offset | Name | Info |
|---|---|---|
| 0x000 | SSPCR0 | Control register 0, SSPCR0 on page 3-4 |
| 0x004 | SSPCR1 | Control register 1, SSPCR1 on page 3-5 |
| 0x008 | SSPDR | Data register, SSPDR on page 3-6 |
| 0x00c | SSPSR | Status register, SSPSR on page 3-7 |
| 0x010 | SSPCPSR | Clock prescale register, SSPCPSR on page 3-8 |
| Offset | Name | Info |
|---|---|---|
| 0x014 | SSPIMSC | Interrupt mask set or clear register, SSPIMSC on page 3-9 |
| 0x018 | SSPRIS | Raw interrupt status register, SSPRIS on page 3-10 |
| 0x01c | SSPMIS | Masked interrupt status register, SSPMIS on page 3-11 |
| 0x020 | SSPICR | Interrupt clear register, SSPICR on page 3-11 |
| 0x024 | SSPDMACR | DMA control register, SSPDMACR on page 3-12 |
| 0xfe0 | SSPPERIPHID0 | Peripheral identification registers, SSPPeriphID0-3 on page 3-13 |
| 0xfe4 | SSPPERIPHID1 | Peripheral identification registers, SSPPeriphID0-3 on page 3-13 |
| 0xfe8 | SSPPERIPHID2 | Peripheral identification registers, SSPPeriphID0-3 on page 3-13 |
| 0xfec | SSPPERIPHID3 | Peripheral identification registers, SSPPeriphID0-3 on page 3-13 |
| 0xff0 | SSPPCELLID0 | PrimeCell identification registers, SSPPCellID0-3 on page 3-16 |
| 0xff4 | SSPPCELLID1 | PrimeCell identification registers, SSPPCellID0-3 on page 3-16 |
| 0xff8 | SSPPCELLID2 | PrimeCell identification registers, SSPPCellID0-3 on page 3-16 |
| 0xffc | SSPPCELLID3 | PrimeCell identification registers, SSPPCellID0-3 on page 3-16 |
SPI: SSPCR0 Register
Offset: 0x000
Description
Control register 0, SSPCR0 on page 3-4
Table 1100. SSPCR0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:16 | Reserved. | - | - |
| 15:8 | SCR : Serial clock rate. The value SCR is used to generate the transmit and receive bit rate of the PrimeCell SSP. The bit rate is: \( F_{SSPCLK} \times \text{CPSDVSR} \times (1 + \text{SCR}) \) where CPSDVSR is an even value from 2-254, programmed through the SSPCPSR register and SCR is a value from 0-255. | RW | 0x00 |
| 7 | SPH : SSPCLKOUT phase, applicable to Motorola SPI frame format only. See Motorola SPI frame format on page 2-10. | RW | 0x0 |
| 6 | SPO : SSPCLKOUT polarity, applicable to Motorola SPI frame format only. See Motorola SPI frame format on page 2-10. | RW | 0x0 |
| 5:4 | FRF : Frame format: 00 Motorola SPI frame format. 01 TI synchronous serial frame format. 10 National Microwire frame format. 11 Reserved, undefined operation. | RW | 0x0 |
| 3:0 | DSS : Data Size Select: 0000 Reserved, undefined operation. 0001 Reserved, undefined operation. 0010 Reserved, undefined operation. 0011 4-bit data. 0100 5-bit data. 0101 6-bit data. 0110 7-bit data. 0111 8-bit data. 1000 9-bit data. 1001 10-bit data. 1010 11-bit data. 1011 12-bit data. 1100 13-bit data. 1101 14-bit data. 1110 15-bit data. 1111 16-bit data. | RW | 0x0 |
SPI: SSPCR1 Register
Offset: 0x004
Description
Control register 1, SSPCR1 on page 3-5
Table 1101. SSPCR1 Register
| Bits Register 31:21 20 19:16 15:12 11:0 | column_2 | Description ARCHITECT : Defines the architect of the component. Bits [31:28] are the PRESENT : Defines that the DEVARCH register is present REVISION : Defines the architecture revision of the component ARCHVER : Defines the architecture version of the component ARCHPART : Defines the architecture of the component | Type RO RO RO RO RO | Reset 0x23b 0x1 0x0 0x1 0xa02 |
|---|---|---|---|---|
| 31:4 | Reserved. | - | - | |
| 3 | SOD | : Slave-mode output disable. This bit is relevant only in the slave mode, slave drives data onto its serial output line. In such systems the RXD lines | RW | 0x0 |
| 2 | MS | not drive the SSPTXD output in slave mode. : Master or slave mode select. This bit can be modified only when the Device configured as slave. | RW | 0x0 |
| 1 | SSE | : Synchronous serial port enable: 0 SSP operation disabled. 1 SSP operation enabled. | RW | 0x0 |
| 0 | LBM | : Loop back mode: 0 Normal serial port operation enabled. 1 Output of | RW | 0x0 |
| Bits | Description | Type | Reset | |
| 31:16 | Reserved. | - | - | |
| 15:0 | DATA | : Transmit/Receive FIFO: Read Receive FIFO. Write Transmit FIFO. You The receive logic automatically right-justifies. | RWF | - |
| Bits | Description | Type | Reset | |
| 31:5 | Reserved. | - | - | |
| 4 | BSY | : PrimeCell SSP busy flag, RO: 0 SSP is idle. 1 SSP is currently transmitting and/or receiving a frame or the transmit FIFO is not empty. | RO | 0x0 |
| 3 | RFF | : Receive FIFO full, RO: 0 Receive FIFO is not full. 1 Receive FIFO is full. | RO | 0x0 |
| 2 | RNE | : Receive FIFO not empty, RO: 0 Receive FIFO is empty. 1 Receive FIFO is not empty. | RO | 0x0 |
| 1 | TNF full. | : Transmit FIFO not full, RO: 0 Transmit FIFO is full. 1 Transmit FIFO is not | RO | 0x1 |
| 0 | TFE | : Transmit FIFO empty, RO: 0 Transmit FIFO is not empty. 1 Transmit FIFO is empty. | RO | 0x1 |
SPI: SSPDR Register
Offset: 0x008
Description
Data register, SSPDR on page 3-6
Table 1102. SSPDR Register
SPI: SSPSR Register
Offset: 0x00c
Description
Status register, SSPSR on page 3-7
Table 1103. SSPSR Register
SPI: SSPCPSR Register
Offset: 0x010
Description
Clock prescale register, SSPCPSR on page 3-8
Table 1104. SSPCPSR Register
| Bits 23:16 15:8 7:0 Bits 31:24 | column_2 | Description ATTR2 : Memory attribute encoding for MPU regions with an AttrIndex of 2 ATTR1 : Memory attribute encoding for MPU regions with an AttrIndex of 1 ATTR0 : Memory attribute encoding for MPU regions with an AttrIndex of 0 Description ATTR7 : Memory attribute encoding for MPU regions with an AttrIndex of 7 | Type RW RW RW Type RW | Reset 0x00 0x00 0x00 Reset 0x00 | Description |
|---|---|---|---|---|---|
| 31:8 | Reserved. | - | - | Table 1104. SSPCPSR | |
| 7:0 | CPSDVSR | : Clock prescale divisor. Must be an even number from 2-254, depending on the frequency of SSPCLK. The least significant bit always returns zero on reads. | RW | 0x00 | Table 1104. SSPCPSR |
| Bits | Description | Type | Reset | Offset : 0x014 Description Interrupt mask set or clear register, SSPIMSC on page 3-9 Table 1105. SSPIMSC | |
| 31:4 | Reserved. | - | - | Register | |
| 3 | TXIM | : Transmit FIFO interrupt mask: 0 Transmit FIFO half empty or less condition interrupt is masked. 1 Transmit FIFO half empty or less condition interrupt is not masked. | RW | 0x0 | Register |
| 2 | RXIM | : Receive FIFO interrupt mask: 0 Receive FIFO half full or less condition masked. | RW | 0x0 | Register |
| 1 | RTIM | : Receive timeout interrupt mask: 0 Receive FIFO not empty and no read read prior to timeout period interrupt is not masked. | RW | 0x0 | Register |
| 0 | RORIM | : Receive overrun interrupt mask: 0 Receive FIFO written to while full condition interrupt is masked. 1 Receive FIFO written to while full condition interrupt is not masked. | RW | 0x0 | Register |
| Bits | Description | Type | Reset | Offset : 0x018 Description Raw interrupt status register, SSPRIS on page 3-10 Table 1106. SSPRIS | |
| 31:4 | Reserved. | - | - | Register | |
| 3 | TXRIS | : Gives the raw interrupt state, prior to masking, of the SSPTXINTR interrupt | RO | 0x1 | Register |
| 2 | RXRIS | : Gives the raw interrupt state, prior to masking, of the SSPRXINTR interrupt | RO | 0x0 | Register |
| 1 | RTRIS | : Gives the raw interrupt state, prior to masking, of the SSPRTINTR interrupt | RO | 0x0 | Register |
SPI: SSPIMSC Register
Offset: 0x014
Description
Interrupt mask set or clear register, SSPIMSC on page 3-9
Table 1105. SSPIMSC Register
SPI: SSPRIS Register
Offset: 0x018
Description
Raw interrupt status register, SSPRIS on page 3-10
Table 1106. SSPRIS Register
| Bits 2 1 0 Bits | Description RESET PUSH DATA Description | : Reset (before sending a new key) | Type RW RW RW Type | Reset 0x0 0x0 0x0 Reset |
|---|---|---|---|---|
| 31:4 | Reserved. | - | - | |
| 3 | TXMIS | : Gives the transmit FIFO masked interrupt state, after masking, of the | RO | 0x0 |
| 2 | RXMIS | SSPTXINTR interrupt : Gives the receive FIFO masked interrupt state, after masking, of the | RO | 0x0 |
| 1 | RTMIS | SSPRXINTR interrupt : Gives the receive timeout masked interrupt state, after masking, of the | RO | 0x0 |
| 0 | RORMIS | SSPRTINTR interrupt : Gives the receive over run masked interrupt status, after masking, of the SSPRORINTR interrupt | RO | 0x0 |
| Bits | Description | Type | Reset | |
| 31:2 | Reserved. | - | - | |
| 1 | RTIC | : Clears the SSPRTINTR interrupt | WC | 0x0 |
| 0 | RORIC | : Clears the SSPRORINTR interrupt SSPDMACR Register | WC | 0x0 |
| Bits | Description | Type | Reset | |
| 31:2 | Reserved. | - | - | |
| 1 | TXDMAE | : Transmit DMA Enable. If this bit is set to 1, DMA for the transmit | RW | 0x0 |
| 0 | RXDMAE | FIFO is enabled. : Receive DMA Enable. If this bit is set to 1, DMA for the receive FIFO is enabled. | RW | 0x0 |
SPI: SSPMIS Register
Offset: 0x01c
Description
Masked interrupt status register, SSPMIS on page 3-11
Table 1107. SSPMIS Register
SPI: SSPICR Register
Offset: 0x020
Description
Interrupt clear register, SSPICR on page 3-11
Table 1108. SSPICR Register
SPI: SSPDMACR Register
Offset: 0x024
Description
DMA control register, SSPDMACR on page 3-12
Table 1109. SSPDMACR Register
SPI: SSPPERIPHID0 Register
Offset: 0xfe0
Table 1114.
SSPPCELLID0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | SSPPCELLID0 : These bits read back as 0x0D | RO | 0x0d |
SPI: SSPPCELLID1 Register
Offset: 0xff4
Description
PrimeCell identification registers, SSPPCellIID0-3 on page 3-16
Table 1115.
SSPPCELLID1 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | SSPPCELLID1 : These bits read back as 0xF0 | RO | 0xf0 |
SPI: SSPPCELLID2 Register
Offset: 0xff8
Description
PrimeCell identification registers, SSPPCellIID0-3 on page 3-16
Table 1116.
SSPPCELLID2 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | SSPPCELLID2 : These bits read back as 0x05 | RO | 0x05 |
SPI: SSPPCELLID3 Register
Offset: 0xffc
Description
PrimeCell identification registers, SSPPCellIID0-3 on page 3-16
Table 1117.
SSPPCELLID3 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | SSPPCELLID3 : These bits read back as 0xB1 | RO | 0xb1 |