spiwrite: Write Register to SPI
The application spiwrite
writes a value to an address. The same applies to the optional specification
of the chip select line as the last parameter as for reading with spiread
.
Synopsis
- Options:
- -h, --help
Displays help on commandline options.
- --help-all
Displays help, including generic Qt options.
- -v, --version
Displays version information.
- -a, --address <host>
Host address of the gateway [localhost].
- -p, --port <port>
Port of the gateway [51955].
- -f, --frequency <period>
Frequency (period) of sending in ms [1000].
- -s, --severity <level>
Max severity (fatal|error|warning|info|debug|verbose) of log message.
- -F, --file <filename>
Logs to file.
- -C, --console <stream>
Console output stream (off|std|err) of log messages [std].
- --debug
Report additional debug info in log.
- -J, --json
Enable JSON output.
- --stop <number>
Stop after received messages.
- --error <number>
Stop after received error messages.
- -1, --once
Stop after first received message or error.
- -r, --register <value>
Register address of the SPI device.
- -d, --data <mode>
Interpret data as (array|8|16|32|64) byte.
- -e, --endian <endian>
Endianness of the value (little|big) [little].
- --value <value>
Value (8|16|32|64 bit) to be set.
- Arguments:
chipselect Optional chipselect of SPI device.
Examples
The command ./spiwrite -a blackbox0007.local -s info -d 8 -1 -r 0x20 --value 0b01000111 0
selects the device at
output pin 0 and sets the register with address 0x20 to the specified value. The following text is output to console:
2025-07-23 13:25:15.231 INFO Use little endian to interpret data.
2025-07-23 13:25:15.379 INFO SPI-Write with chipselect 0.