SPI-CONFIG(1)
π SPI-CONFIG β ok bestie, let's talk SPI
so this is the spi-config page from the SPI-tools manual, section 1 (User Commands), and honestly? she's a baddie. let's get into it π«Ά
β¨ NAME β¨
spi-config β set or query SPI configuration. that's it, that's the job. set it or query it, no cap. π
πΈ SYNOPSIS πΈ
spi-config options...
just options, one after another. no positional args, she's a flags-only kind of girlie. π
π¦ DESCRIPTION π¦
okay so. spi-config sets or queries the configuration of a SPI port. that's the whole vibe.
then it hands you the entire menu of flags, and here they all are, every single one, don't skip:
-d,--device=DEVICEβ use the given Linux spidev character device. like, this is the device you're talking to. point her at the right one. π-q,--queryβ print the current configuration. a lil peek at what's going on rn. π-m,--mode=[0-3]β set the spi mode. modes live down below in SPI MODES, iykyk. ποΈ-l,--lsb={0,1}β set LSB first (1) or MSB first (0). bit order, pick a lane. π-b,--bits=[7...]β set the number of bits per word. seven or more, she said what she said. π’-s,--speed=FREQUENCYβ set clock frequency, and it's in Hz. so yes,1000000means 1 MHz. do the math bestie. β‘-r,--spirdy={0,1}β set the SPI READY mode flag. π-s,--waitβ block, keeping the file descriptor open. see WAIT OPTION below, it matters fr fr. β-h,--helpβ display the help screen and exit. the classic. π-v,--versionβ display the version number and exit. π·οΈ
ok so not me noticing that-sshows up twice in this list, once for--speedand once for--wait, and that WAIT OPTION below talks about a-woption. i'm literally just reading you what's on the page, bestie. i don't make the rules, i just serve them. π
π₯ SPI MODES π₯
four modes, and the only thing that changes is the idle level and which edge she samples on. clock behavior tea:
- mode 0 β low iddle level, sample on leading edge.
- mode 1 β low iddle level, sample on trailing edge.
- mode 2 β high iddle level, sample on leading edge.
- mode 3 β high iddle level, sample on trailing edge.
see the pattern? leading/trailing alternates inside each pair, low/high flips between the pairs. slay. π
π§ WAIT OPTION π§
here's the tea, and it's a lil spicy: on some platforms, the speed is reset to a default value when the file descriptor is closed. π
to avoid that, one can use the -w option β it keeps the file descriptor open. see also the last example below. π«Ά
π EXAMPLES π
get help:
$ spi-config -h
query current configuration:
$ spi-config --device=/dev/spidev0.0 -q
change clock frequency to 1 MHz:
$ spi-config --device=/dev/spidev0.0 --speed=1000000
set a configuration and keep the device open:
$ spi-config --wait --speed=1000000 & PID=$!
close device previously open:
$ kill $PID
see how the last two go together? open her, keep her open, then kill her when you're done. main character lifecycle fr. π
π AUTHOR π
written by Christophe BLAESS <https://www.blaess.fr/christophe>. thank you for your service, legend. π«‘
π REPORTING BUGS π
github home page: <https://github.com/cpb-/spi-tools.git>
found a bug? take it to the repo, bestie, don't suffer in silence. π
π COPYRIGHT π
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. no cap, no promises, no take-backs. π
and that's the whole page, you ate it. π β¨ this was SPI-tools, August 2014, SPI-CONFIG(1) β mwah, go configure something cute. ππ¦
π¦ where this page comes from
- alpine 3.24: spi-tools-doc 1.0.2-r0 Β· GPL-2.0-or-later
- fedora 43: spi-tools 1.0.2-7.fc43 Β· GPL-2.0-only
- fedora 44: spi-tools 1.0.2-8.fc44 Β· GPL-2.0-only
- nixos 26.05: spi-tools 1.0.2
- opensuse-leap 16.0: spi-tools 1.0.2-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: spi-tools 1.0.2-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: spi-tools 1.0.2-bp160.1.12 Β· GPL-2.0-or-later
- opensuse-leap 16.0: spi-tools 1.0.2-bp160.1.12 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms