Hello,
trying this and that with a qwiic relay, first a test on i2ccl then VS using a 9160DK.
(i2ccl -> pip install i2cdriver)
i2ccl /dev/ttyUSB0 w 0x18 5 r 0x18 1
returns a status of 0x00 that relay is not activated.
then in VS,
uint8_t wBuff[1] = {0x05}; uint8_t rBuff = 0x00; uint8_t a = 0; a = i2c_write_read_dt(&dev_i2c, wBuff, sizeof(wBuff), &rBuff, sizeof(rBuff)); if (a != 0) { printk("I2C error %d\n", a); } printk("Status: %X\n", rBuff);
Status: 0
same as i2ccl
Then when trying to activate the relay with a write,
i2ccl /dev/ttyUSB0 w 0x18 1 p
the relay clicks on ok
But in VS,
uint8_t wArray[1] = {0x01}; uint8_t a = 0; a = i2c_write_dt(&dev_i2c, wArray, 1); if (a != 0) { printk("I2C write failed with error %d\n", a); }
There is no click response.
The difference seems to be that i2ccl is sending stop 'p' at the end of the write which Zephyr might not be doing the same.
When trying write and read 0x05 status separately in VS, the result is ok and same as i2ccl without stop.
If it is the missing stop, how best then to get a stop into i2c_write_dt?
thank-you,