SPI Slave Zero
SPI Slave Zero is a specification for SPI peripheral intended for verification of SPI master drivers. The concept is borrowed from that of USB Gadget Zero which serves as a test endpoint for USB HCI drivers. The intention of the specification is to be broad enough to be implemented on a wide range of microcontrollers and SoCs with capable hardware SPI slave peripherals or optionally via bitbanging.
SSZ Specification Rev 0.1 DRAFT
SPI Slave Zero (SSZ) is a SPI peripheral supporting streaming read of a data test pattern, write sinking, and optionally write storage and read back for data integrity testing. The peripheral supports a combination of out-of-band signals to control reset and fundamental protocol configuration as well as a register set for driver discovery of supported features for a given implementation.
SSZ requires the following minimal signal resources:
- RESETn is asserted by the master for 10ms.
- MODE[1..0] is asserted with the SPI clock polarity/phase mode (encoded as MODE==CPOL and MODE==CPHA)
- RESETn is deasserted
Once initialized, the SSZ device will operate using the polarity/phase mode sampled when RESETn is deasserted. All internal registers will be reset to their defaults after RESETn is deasserted.
After initialization, the maximum clock rate of the SSZ device is unknown by the SPI master. The master shall initially drive SCLK at a frequency of no more than 100 KHz. This allows SSZ to be implemented in a wide range of hardware. Discovery of the actual max SSZ implementation frequency can be performed by reading an internal SSZ register.
Register Read/Write Protocol
Internal registers are accessed only in 8-bit word mode. Register addresses are 8-bits and each register is 8-bits in size.
A register cycle consists of an address word being written to select an internal register. This is followed by a second word that is read/written in order to read/write the 8-bit register contents.
There is no parser hook that handles "<Insert timing diagram here> </p>
- <a href="#Registers">1 Registers</a>
- <a href="#Version_.280x00.29">1.1 Version (0x00)</a>
- <a href="#Clock_Rate_High_.280x01.29">1.2 Clock Rate High (0x01)</a>
- <a href="#Clock_Rate_Low_.280x02.29">1.3 Clock Rate Low (0x02)</a>
7 6 5 4 3 2 1 0 M M M M N N N N
MMMM and NNNN are BCD encoded digits of the SSZ implementation version. For 0.1 this corresponds to 00000001
Clock Rate High (0x01)
7 6 5 4 3 2 1 0 H H H H H H H H
Clock Rate Low (0x02)
7 6 5 4 3 2 1 0 L L L L L L L L