jamesbowman / i2cdriver

I2CDriver open source tools
https://i2cdriver.com/
BSD 3-Clause "New" or "Revised" License
187 stars 57 forks source link

How many status bytes are supposed to read after a command??? #31

Closed codehero closed 4 years ago

codehero commented 4 years ago

It seems that after doing a [0xc0 0x01] command to I2C driver, I sometimes have to read 2 status bytes before the next command processes. The following are 2 straces. The first command sometimes results in a hangup; the second always seems to not hang but seomtimes ends up with weird communication errors. The difference is in the second is that a read for 16 bytes commences after the write request

openat(AT_FDCWD, "\x2f\x64\x65\x76\x2f\x74\x74\x79\x55\x53\x42\x30", O_RDWR|O_NOCTTY) = 3 ioctl(3, TCGETS, {B1000000 -opost -isig -icanon -echo ...}) = 0 ioctl(3, TCGETS, {B1000000 -opost -isig -icanon -echo ...}) = 0 ioctl(3, SNDCTL_TMR_START or TCSETS, {B1000000 -opost -isig -icanon -echo ...}) = 0 ioctl(3, TCGETS, {B1000000 -opost -isig -icanon -echo ...}) = 0 write(3, "\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40"..., 64) = 64 write(3, "\x65\x41", 2) = 2 read(3, "\x41", 1) = 1 write(3, "\x65\x0d", 2) = 2 read(3, "\x0d", 1) = 1 write(3, "\x65\x0a", 2) = 2 read(3, "\x0a", 1) = 1 write(3, "\x65\x00", 2) = 2 read(3, "\x00", 1) = 1 write(3, "\x3f", 1) = 1 read(3, "\x5b\x69\x32\x63\x64\x72\x69\x76\x65\x72\x31\x20\x44\x4f\x30\x31\x4a\x54\x35\x55\x20\x30\x30\x30\x30\x30\x30\x38\x30\x38\x20\x34"..., 80) = 80 write(3, "\x78", 1) = 1 write(3, "\x72", 1) = 1 write(3, "\x31", 1) = 1 write(3, "\x69", 1) = 1 write(3, "\x73\x62", 2) = 2 read(3, "\x33", 1) = 1

write(3, "\xc0\x01", 2) = 2 read(3, "\x31", 1) = 1 write(3, "\x70", 1) = 1

openat(AT_FDCWD, "\x2f\x64\x65\x76\x2f\x74\x74\x79\x55\x53\x42\x30", O_RDWR|O_NOCTTY) = 3 ioctl(3, TCGETS, {B1000000 -opost -isig -icanon -echo ...}) = 0 ioctl(3, TCGETS, {B1000000 -opost -isig -icanon -echo ...}) = 0 ioctl(3, SNDCTL_TMR_START or TCSETS, {B1000000 -opost -isig -icanon -echo ...}) = 0 ioctl(3, TCGETS, {B1000000 -opost -isig -icanon -echo ...}) = 0 write(3, "\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40"..., 64) = 64 write(3, "\x65\x41", 2) = 2 read(3, "\x41", 1) = 1 write(3, "\x65\x0d", 2) = 2 read(3, "\x0d", 1) = 1 write(3, "\x65\x0a", 2) = 2 read(3, "\x0a", 1) = 1 write(3, "\x65\x00", 2) = 2 read(3, "\x00", 1) = 1 write(3, "\x3f", 1) = 1 read(3, "\x5b\x69\x32\x63\x64\x72\x69\x76\x65\x72\x31\x20\x44\x4f\x30\x31\x4a\x54\x35\x55\x20\x30\x30\x30\x30\x30\x34\x32\x37\x35\x20\x34"..., 80) = 80 write(2, "\x5b\x69\x32\x63\x64\x72\x69\x76\x65\x72\x31\x20\x44\x4f\x30\x31\x4a\x54\x35\x55\x20\x30\x30\x30\x30\x30\x34\x32\x37\x35\x20\x34"..., 81[i2cdriver1 DO01JT5U 000004275 4.981 000 27.4 I 1 1 100 24 0168 ] ) = 81 write(3, "\x78", 1) = 1 write(3, "\x72", 1) = 1 write(3, "\x31", 1) = 1 write(3, "\x69", 1) = 1 = 4 write(3, "\x73\x62", 2) = 2 read(3, "\x33", 1) = 1 write(3, "\xc0\x01", 2) = 2 read(3, "\x31", 1) = 1 write(3, "\x70", 1) = 1

codehero commented 4 years ago

Documentation has been updated as per issue #30 . No more need for this issue