SPI_HOST HWIP Technical Specification
Overview
This document specifies SPI_HOST hardware IP (HWIP) functionality. This module conforms to the Comportable guideline for peripheral functionality. See that document for integration overview within the broader top-level system.
Features
- Hardware control for remote devices using the Serial Peripheral Interface (SPI)
- Primarily designed for serial NOR flash devices such as the Winbond W25Q01JV
- Number of chip select lines controlled by
NumCS
parameter - Support for Standard SPI, Dual SPI or Quad SPI commands
- Signals SD[0] through SD[3] are intended to connect to lines IO0 through IO3 respectively, on the target device.
- Signal SD[0] may also be identified as “MOSI” by other SPI Hosts, while SD[1] is commonly referred to as “MISO”
- RX and TX data held in separate FIFOs
- 288 bytes for TX data, 256 bytes for RX data
- FIFOs loaded/unloaded via 32-bit TL-UL registers
- Support for arbitrary byte-count in each transaction
- Parametrizable support for Big- or Little-Endian systems in ordering I/O bytes within 32-bit words.
- SPI clock rate controlled by separate input clock to core
- SPI SCK line typically toggles at 1/2 the core clock frequency
- An additional clock rate divider exists to reduce the frequency if needed
- Support for all SPI polarity and phases (CPOL, CPHA)
- Additional support for “Full-cycle” SPI transactions, wherein data can be read a full SPI Clock cycle after the active edge (as opposed to one half cycle as is typical for SPI interfaces)
- Single Transfer Rate (STR) only (i.e. data received on multiple lines, but only on one clock edge)
- No support for Dual Transfer Rate (DTR)
- Pass-through mode for coordination with SPI_DEVICE IP
- Automatic control of chip select lines
- Condensed interrupt footprint: Two lines for two distinct interrupt classes: “error” and “spi_event”
- Fine-grain interrupt masking supplied by secondary enable registers
Description
The Serial Peripheral Interface (SPI) is a synchronous serial interface, commonly used for NOR flash devices and off-chip peripherals such as ADCs, DACs, or temperature sensors.
The interface is a de facto standard (not a formal one), so there is no definitive reference or established compliance criteria. It is therefore important to consult the data sheets for the desired peripheral devices in order to ensure compatibility. The OpenTitan SPI_HOST IP is primarily designed for controlling Quad SPI NOR flash devices, such as the W25Q01JV Serial NOR flash from Winbond or the 1 Gb M25QL NOR flash from Micron. The implementation however is runtime-configurable to support a wide variety of devices, although the Winbond serial flash device is used as the primary reference for understanding our host requirements.
There are also a number of good references describing legacy host implementations for this protocol, which are useful for understanding some of the general needs for a wider range of target devices. For instance, the legacy SPI Block Guide from Motorola contains a definitive overview of some of the general requirements for a standard SPI host, notably the definitions of SPI clock phase and polarity (CPOL and CPHA).