Skip to main content

SPI

These commands are available three ways — in the FREE-WILi GUI app, in a serial terminal, and on the device itself. See Connecting it to a computer for how to reach them.

Write and Read​

Performs a full-duplex SPI transaction: writes the supplied bytes on MOSI while simultaneously capturing the bytes returned on MISO, then prints the received bytes.

Usage​

Enter one or more data bytes as hexadecimal values separated by spaces.

w 9F
w 03 00 00 00
w AB CD EF

Example​

Reading a SPI flash JEDEC ID:

w 9F 00 00 00

Response bytes 2–4 contain the manufacturer / device ID.

How to use it — press w. At the prompt, enter: Data Byte(s) Separated By Spaces.

What you enter — data_bytes.

SPI Slave Enable​

Toggles this device into SPI slave mode on the breakout bus (MISO 12 / CS 13 / SCLK 14 / MOSI 15).

CPHA requirement for multi-byte transfers​

The master here holds Chip Select low for the whole duration of a Write and Read (w), not just one byte. The PL022 SPI peripheral behind this slave mode only supports that when CPHA is 1: at the default CPHA=0, the hardware requires Chip Select to pulse between every single byte, so only the first byte of a multi-byte transfer is valid and every byte after it reads back as idle (0xFF) on both sides. Set CPHA (SPI Settings a) to 1 on BOTH the master and the slave board before exchanging more than one byte; a single-byte transfer works at either CPHA setting.

Direction apply while slave is active​

An FPGA/direction operation while slave mode is active may steal the SPI pins; re-enable slave mode if that happens.

How to use it — press e.

Set SPI Slave Response Data​

Stores the bytes the SPI slave will clock out on MISO when a master transfers. Limited to 8 bytes -- the PL022 transmit FIFO depth.

Usage​

l A1 B2 C3 D4

How to use it — press l. At the prompt, enter: Up To 8 Data Byte(s) Separated By Spaces.

What you enter — data_bytes.

See also: SPI panel — the on-screen panel for this.