Collapse OS Documentation Browser


asm/ code/ hw/ algo.txt arch.txt avr.txt blk.txt blksrv.txt bootstrap.txt cross.txt design.txt dict.txt dis.txt drivers.txt ed.txt emul.txt faq.txt grid.txt grok.txt impl.txt intro.txt me.txt mspan.txt ps2.txt rxtx.txt sdcard.txt sega.txt selfhost.txt spi.txt usage.txt wordtbl.txt

Communicating through SPI

Many very useful device are able to communicate through the SPI
protocol, for example, SD cards and AVR MCUs. In many cases,
however, CPUs can't "speak SPI" because of their inability to

In most cases, we need an extra peripheral, which we can build
ourselves, to interface with devices that "speak SPI". We call
this peripheral a SPI relay.

The design of those relays depend on the CPU architecture. See
spi.txt in arch-specific folders for more information.

SPI Relay protocol

This protocol enables communication with a SPI relay. This
protocol is designed to support devices with multiple endpoints.
To that end, (spie) takes a device ID argument, with a meaning
that is up to the device itself. To disable all devices, supply
0 to (spie).

We expect relay devices to support only one enabled device at
once. Enabling a specific device is expected to disable the
previously enabled one.

(spie)    n --     Enable SPI device
(spix)    n -- n   Perform SPI exchange (push a number, get a
                   number back)

There is no SPI subsystem, but other subsystems depend on the
SPI protocol being fulfilled:

* SD Card subsystem (doc/sdcard)

Collapse OS and its documentation are created by Virgil Dupras and licensed under the GNU GPL v3.

This documentation browser by James Stanley. Please report bugs on github or to

This page generated at 2024-06-23 21:05:04 from documentation in CollapseOS snapshot 20230427.