Code: Select all
Time [s], Analyzer Name, Decoded Protocol Result
1.480686500000000,I2C,Setup Write to [0x6C] + NAK
1.480796500000000,I2C,Setup Read to [0x6D] + NAK
1.480918000000000,I2C,Setup Write to [0x6C] + NAK
1.481028000000000,I2C,Setup Read to [0x6D] + NAK
1.481149000000000,I2C,Setup Write to [0x6C] + NAK
1.481259000000000,I2C,Setup Read to [0x6D] + NAK
1.482386500000000,I2C,Setup Write to [0x6C] + ACK
1.482476500000000,I2C,0x30 + ACK
1.482566500000000,I2C,0x0A + ACK
1.482676500000000,I2C,Setup Read to [0x6D] + ACK
1.482766500000000,I2C,0x56 + ACK
1.482856500000000,I2C,0x47 + NAK
...
There are 3 "empty" write to 6C, read from 6D, followed by write 0x30 0x0A and read back camera ID 0x56 0x47.
Now I tried to do same with I2C tools command sequence with this script (12298 is 0x300A):
Code: Select all
$ cat doit
#!/bin/bash
yes | sudo i2cget 0 0x36 0
yes | sudo i2cget 0 0x36 0
yes | sudo i2cget 0 0x36 0
yes | sudo i2cset 0 0x36 1 12298 w
yes | sudo i2cget 0 0x36 0 w
$
I did capture traffic with logic analyzer again, and this is all what I saw:
Code: Select all
Time [s], Analyzer Name, Decoded Protocol Result
1.413943000000000,I2C,Setup Write to [0x6C] + NAK
1.414053000000000,I2C,Setup Read to [0x6D] + NAK
1.500663000000000,I2C,Setup Write to [0x6C] + NAK
1.500773000000000,I2C,Setup Read to [0x6D] + NAK
1.570027500000000,I2C,Setup Write to [0x6C] + NAK
1.570137500000000,I2C,Setup Read to [0x6D] + NAK
1.640882500000000,I2C,Setup Write to [0x6C] + NAK
1.710209000000000,I2C,Setup Write to [0x6C] + NAK
1.710319000000000,I2C,Setup Read to [0x6D] + NAK
And that although the errors in script execution.
But since I captured I2C commands, something worked despite the errors.
And "data 0x300a" seen should write what is needed:
Code: Select all
pi@raspberrypi2B:~ $ sudo ./doit
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-0, chip address 0x36, data address
0x00, using read byte data.
Continue? [Y/n] Error: Read failed
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-0, chip address 0x36, data address
0x00, using read byte data.
Continue? [Y/n] Error: Read failed
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-0, chip address 0x36, data address
0x00, using read byte data.
Continue? [Y/n] Error: Read failed
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will write to device file /dev/i2c-0, chip address 0x36, data address
0x01, data 0x300a, mode word.
Continue? [Y/n] Error: Write failed
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-0, chip address 0x36, data address
0x00, using read word data.
Continue? [Y/n] Error: Read failed
pi@raspberrypi2B:~ $
Captured I2C traffic looks identical for the 3 "empty" write to 6C, read from 6D, but after that things go wrong.
How do I need to change the i2cset command that it does what "raspistill -v" does at that point?