world leader in high performance signal processing
Trace: » spi

Das U-Boot and SPI

Das U-Boot supports SPI busses and provides a simple C API to people developing code as well as a command line interface.

For working with SPI flashes, see the serial-flash page for more information.

Configuration

To enable support for the Blackfin on-chip SPI controller:

#define CONFIG_BFIN_SPI

To enable support for the SPI command line:

#define CONFIG_CMD_SPI

SPI API

The SPI API is documented in the include/spi.h header. Consult that for more information.

Command Line Interface

With the sspi command, you can get low level access (usually for debugging purposes) straight from the command line.

Usage

The biggest thing to keep in mind is that the count is based on bits, not bytes. The command is also always full-duplex, so it will read in the same number of bits as transmitted and automatically display them.

bfin> help sspi
sspi - SPI utility commands

Usage:
sspi <device> <bit_len> <dout> - Send <bit_len> bits from <dout> out the SPI
<device>  - Identifies the chip select of the device
<bit_len> - Number of bits to send (base 10)
<dout>    - Hexadecimal string that gets sent

So to send out the value 0x3f to the device on CS 3 and read back 4 bytes, you would do:

bfin> sspi 3 40 0x3f