i2ctest: Test Device Availability
The command i2ctest
can be used to check the availability of devices connected to the I2C bus.
Two I2C buses can be used independently of each other on The-Black-Box.
Note
Before an I2C bus can be used, it must first be enabled via systemset
.
Synposis
- 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].
- --debug
Report additional debug info in log.
- -s, --severity <level>
Max severity (fatal|error|warning|info|debug|verbose) of log message.
- -b, --bus <value>
I2C bus device connected to [0].
- -f, --full
Test all possible addresses on bus.
- Arguments:
device address of I2C device.
Examples
In the following examples we use an I2C-connected push button breakout board (see https://www.sparkfun.com/products/15932). This device has a Qwiic/STEMMA QT connector that requires specific adapter cable (see https://www.sparkfun.com/products/17912). The color encoding is
red: 3.3V
black: GND
blue: SDA
yellow: SCL
Scan I2C Bus
The command ./i2ctest -a blackbox2 -s info -b 1 --full
scans all I2C addresses of the second I2C bus and
outputs to console the found addresses. On default, the push button has address 0x6f (decimal 111).
2024-05-27 08:06:01.014 NONE Press Ctrl-C to abort application.
2024-05-27 08:06:01.028 INFO Client is connected...
2024-05-27 08:06:01.036 INFO Session identifier 24, protocol version 0
2024-05-27 08:06:01.036 INFO Test all device addresses on bus 1. Wait for a while..
2024-05-27 08:06:01.990 INFO Found 1 devices: 111|0x6f