1SPI-CONFIG(1) User Commands SPI-CONFIG(1)
2
3
4
6 spi-config - set or query SPI configuration.
7
9 spi-config options...
10
12 Set or query the configuration of a SPI port.
13
14 -d, --device=DEVICE
15 use the given Linux spidev character device.
16
17 -q, --query
18 print the current configuration.
19
20 -m, --mode=[0-3]
21 set the spi mode (see SPI MODES below).
22
23 -l, --lsb={0,1}
24 set LSB first (1) or MSB first (0).
25
26 -b, --bits=[7...]
27 set the number of bits per word.
28
29 -s, --speed=FREQUENCY
30 set clock frequency (in Hz).
31
32 -r, --spirdy={0,1}
33 set the SPI READY mode flag.
34
35 -s, --wait
36 block, keeping the file descriptor open. See WAIT OPTION below.
37
38 -h, --help
39 display the help screen and exit.
40
41 -v, --version
42 display the version number and exit.
43
44
45 SPI MODES
46 mode 0 low iddle level, sample on leading edge.
47
48 mode 1 low iddle level, sample on trailing edge.
49
50 mode 2 high iddle level, sample on leading edge.
51
52 mode 3 high iddle level, sample on trailing edge.
53
54
55 WAIT OPTION
56 On some platforms, the speed is reset to a default value when the file
57 descriptor is closed. To avoid this, one can use the -w option that
58 keeps the file descriptor open. See also last example below.
59
61 Get help:
62 $ spi-config -h
63
64 Query current configuration:
65 $ spi-config --device=/dev/spidev0.0 -q
66
67 Change clock frequency to 1 MHz:
68 $ spi-config --device=/dev/spidev0.0 --speed=1000000
69
70 Set a configuration and keep the device open:
71 $ spi-config --wait --speed=1000000 & PID=$!
72
73 Close device previously open:
74 $ kill $PID
75
77 Written by Christophe BLAESS <https://www.blaess.fr/christophe>.
78
80 Github home page: <https://github.com/cpb-/spi-tools.git>
81
83 Copyright © 2014 Christophe Blaess.
84 Licensed under GPLv2 <http://gnu.org/licenses/gpl.html>.
85 This is free software: you are free to change and redistribute it.
86 There is NO WARRANTY, to the extent permitted by law.
87
88
89
90SPI-tools August 2014 SPI-CONFIG(1)