Linux I2C-Dev IOCTL-Call produces wrong message

677 views Asked by At

I am working with an I2C-Device under Linux and tried to use the device interface like described under folowing Link.

So if we assume following code:

char outbuf[SIZE] = { 'e', 'b' };

struct i2c_rdwr_ioctl_data msgset;
struct i2c_msg msg[1];

msg[0].addr = 0x53;     // access address 0x53
msg[0].flags = 0;       // 0 means write
msg[0].len = SIZE;      // size is already set to two
msg[0].buf = outbuf

msgset.msgs = msg;
msgset.nmsgs = 1;

ioctl( file, I2C_RDWR, &msgset ); // fille is already assigned, etc.

we would write one message containing two bytes to address 0x53!? Or we could say,

S Addr Wr [A] Data [A] Data [A] P

in the way like its done here.

But when i look at my scope, i get something like this: message complete

or a litle more detailed:

enter image description hereenter image description here

But this is not what we want and not what the specification says, furthermore we get

S Addr Wr [A] Data P S Addr Wr [A] Data P

Does anyone know this behavior or could describe it to me? I tried all types of calls IOCTL, SMBUS, write_block_data. Everytime there is a new Start Condition between data-bytes and the address is also repeated!

Am I getting something wrong?

Thanks for your time and best Regards!

Befedo

1

There are 1 answers

0
Befedo On BEST ANSWER

I found the misalignment...

my hardware was set up like this:

Notebook -> DP/VGA -> I2C-Slave

I used an Notebook which only got an DisplayPort output, converted this via an DP-to-VGA adapter and used the I2C-Interface where a simple Slave was attached.

And it looks like the DP-to-VGA adapter only could serve with Bytewide-Access to the I2C-Bus, so I set up a 'new' Laptop which has an VGA-Interface integrated and used it directly...

enter image description here

Which lead to an perfectly aligned transfer, like it was expected.