spi-pipe − full-duplex SPI communication tool.
spi-pipe options...
This program
allows full-duplex communications, sending data from its
standard input to the SPI slave, and displaying on its
standard output the data received from the SPI port.
−d, −−device=DEVICE
use the given Linux spidev character device.
−s, −−speed=<int>
set the target SPI speed for transfer.
−b, −−blocksize=<int>
set the block size (in bytes) for transfer.
−n, −−number=<int>
set the number of blocks to transmit (-1 for continuous transfert).
−h, −−help
display the help screen and exit.
−v, −−version
display the version number and exit.
Get help:
$ spi−pipe −h
Send and receive at the same time
$ command-1 |
spi−pipe −−device=/dev/spidev0.0 |
command-2
Note that command-1, command-2 and
spi−pipe run simultaneously in three different
processes.
Send data to the SPI link
$ command-1 | spi−pipe −−device=/dev/spidev0.0
Receive data from the SPI link
$ spi−pipe
−−device=/dev/spidev0.0 < /dev/zero |
command-2
You can also use command-2 < /dev/spidev0.0 but
with spi-pipe you can control what is sent to the
device (always ‘0‘ here).
Read 40 blocks of 4 bytes from the SPI link
$ spi−pipe −−device=/dev/spidev0.0 −b 4 −n 40 < /dev/zero | command-2
Written by Christophe BLAESS <https://www.blaess.fr/christophe>.
Github home page: <https://github.com/cpb-/spi-tools.git>
Copyright ©
2014 Christophe Blaess.
Licensed under GPLv2
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and
redistribute it.
There is NO WARRANTY, to the extent permitted by law.