简体   繁体   中英

Linux I2C-Dev IOCTL-Call produces wrong message

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: 讯息完成

or a litle more detailed:

在此处输入图片说明在此处输入图片说明

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

S Addr Wr [A] Data PS 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

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...

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM