USB-ISS C driver API and CLI tool for Linux and Windows.
- CLI interface to read/write arbitrary number of bytes from I2C slave
- Windows/Linux support
- Prebuild Windows executable for command line
- Easy to use C-API for project integration
Version | Date | Source | Change log |
---|---|---|---|
latest | latest.zip | ||
v0.4.0 | 2023-11-23 | v0.4.0.zip | introduce CLI option '-s', scans for I2C devices |
v0.3.0 | 2023-11-14 | v0.3.0.zip | update Simple UART match USB-ISS uart port by VID/PID |
v0.2.0 | 2023-10-21 | v0.2.0.zip | introduce CLI option '-t' and '-l' use first found UART port as default USB-ISS firmware revision check |
v0.1.0 | 2023-08-27 | v0.1.0.zip | fix Simple UART compile warnings check USB-ISS status bytes before read add Doxygen CI |
v0.0.1 | 2023-08-04 | v0.0.1.zip | initial draft |
Argument | Description | Remark |
---|---|---|
-p, --port=[first] | USB-ISS belonging port, usbiss -l for valid options | default: first found UART port |
-b, --baud=[230400] | communication speed Host/USB-ISS | UART baud rate |
-m, --mode=[I2C_S_100KHZ] | I2C transfer mode, use usbiss -h for valid modes | f.e. I2C_H_400KHZ |
-c, --command={cmd} | I2C access to perform write: adr7 w b0 bn read: adr7 r cnt write-read: adr7 w bn r cnt |
adr7: I2C slave address bn: write byte value cnt: number of read bytes |
-s, --scan=[0x3:0x77] | scan I2C bus for devices | default: scan address range 0x3 to 0x77 |
-h, --help | help | |
-v, --version | output USBISS revision | |
-l, --list | list USB-ISS suitable ports | |
-t, --test | checks USB-ISS connection | |
--verbose | enable debug output | |
--brief | output only relevant USBISS responses | write: exit code only, read: read data only |
Checks the connection between PC and USB-ISS:
sudo ./bin/usbiss -t
Following output:
[ INFO ] USBISS started
[ OKAY ] USBISS connected
Baudrate : 230400
Firmware : 0x09
Serial : 00060147
[ OKAY ] ended normally
This example uses the EEPROM 24C256 as exclusively device on the USB-ISS.
Scans I2C bus for devices.
sudo ./bin/usbiss -m I2C_H_400KHz -s
Following output:
[ INFO ] USBISS started
[ OKAY ] USBISS connected
Port : COM6
Baudrate : 230400
Firmware : 0x09
Serial : 00060147
Mode : I2C_H_400KHZ
[ OKAY ] Scan I2C bus in range 0x3:0x77
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[ OKAY ] ended normally
Write to device 0x50 address 0 the data 0x01 0x02 0x03. The Arg accepts arbitary write data length, but keep the page overoll in this case in mind.
sudo ./bin/usbiss -m I2C_H_400KHz -c "0x50 w 0 0 0x01 0x02 0x03"
Following output:
[ INFO ] USBISS started
[ OKAY ] USBISS connected
Baudrate : 230400
Firmware : 0x09
Serial : 00060147
Mode : I2C_H_400KHZ
[ OKAY ] Write 5 bytes to device 0x50
0: 00 00 01 02 03
[ OKAY ] ended normally
Read from device 0x50 address 0 128 bytes.
sudo ./bin/usbiss -m I2C_H_400KHz -c "0x50 w 0 0 r 128"
Following output:
[ INFO ] USBISS started
[ OKAY ] USBISS connected
Baudrate : 230400
Firmware : 0x09
Serial : 00060147
Mode : I2C_H_400KHZ
[ OKAY ] Write/Read interaction with device 0x50
Write 2 Bytes
0: 00 00
Read 128 Bytes
00: 01 02 03 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11
10: 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21
20: 22 23 24 25 26 27 28 29 0a 0b 0c 0d 2e 2f 30 31
30: 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41
40: 0a 0b 0c 0d 1b 71 a4 00 00 00 00 00 00 00 00 00
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ OKAY ] ended normally
int usbiss_list_uart( char *str, size_t len, const char sep[] );
List USB-ISS suitable UART ports.
Arg | Description |
---|---|
str | Found UART ports on system |
len | max length of string |
sep | separator between listed ports |
Number of found UART ports in system.
int usbiss_init( t_usbiss *self );
Initialize USB-ISS handle.
void usbiss_set_verbose( t_usbiss *self, uint8_t verbose );
Set message level of driver.
Arg | Description |
---|---|
verbose | Advanced debug information 0: no debug output 1: debug output via printf |
int usbiss_open( t_usbiss *self, char* port, uint32_t baud );
Open connection to USB-ISS.
Arg | Description |
---|---|
port=[COM1 | /dev/ttyACM0] | System path to USB-ISS belonging UART. Provide empty string "" for default |
baud=[115200] | Baud rate of UART connection. Provide 0 for default |
int usbiss_close( t_usbiss *self );
Close connection to USB-ISS.
int usbiss_set_mode( t_usbiss *self, const char* mode );
Setup USB-ISS transfer mode. Note: Currently only I2C modes supported.
Arg | Description |
---|---|
mode=[USBISS_I2C_S_100KHZ] | I2C Standard: USBISS_I2C_S_20KHZ, USBISS_I2C_S_50KHZ, USBISS_I2C_S_100KHZ, USBISS_I2C_S_400KHZ I2C Fast: USBISS_I2C_H_100KHZ, USBISS_I2C_H_400KHZ, USBISS_I2C_H_1000KHZ |
int usbiss_i2c_scan( t_usbiss *self, int8_t start, int8_t stop, int8_t *i2c, uint8_t len );
Scans given I2C address range for I2C devices. While scanning is for each device a startbit with write access followed by an stopbit transferred.
Arg | Description |
---|---|
start | scan start address |
stop | scan stop address |
i2c | array of found i2c device addresses |
len | i2c array size |
int usbiss_i2c_wr( t_usbiss *self, uint8_t adr7, void* data, size_t len );
Write arbitrary number of bytes to I2C slave.
Arg | Description |
---|---|
adr7 | I2C slave address (7Bit) |
data | array with write data |
len | number of bytes in write array |
int usbiss_i2c_rd( t_usbiss *self, uint8_t adr7, void* data, size_t len );
Read arbitrary number of bytes from I2C slave.
Arg | Description |
---|---|
adr7 | I2C slave address (7Bit) |
data | array with read data |
len | number of requested read bytes |
int usbiss_i2c_wr_rd( t_usbiss *self, uint8_t adr7, void* data, size_t wrLen, size_t rdLen );
Write arbitrary number of bytes to I2C slave, sent repeated start and read arbitrary number of bytes. Write and Read data takes place in the same data buffer.
Arg | Description |
---|---|
adr7 | I2C slave address (7Bit) |
data | array with write/read data |
wrLen | number of bytes to write |
rdLen | number of bytes for read |
Special thanks to AndreRenaud for providing simple_uart. This module allows us to run USBISS for Linux and Windows.