Skip to contentSkip to conversation

i2c_smbus_write_block_data does not send all bytes?!

DISCUSSION Nick Teen 2 participants 2 messages Jul 15, 2008 1 message not in the archive I2C subsystem host drivers

lore
Share & tools
lore

Nick Teen

author
#0 lore raw

Hi Jean,

Quoted 5 lines

You probably want to use i2c_smbus_write_i2c_block_data instead. With i2c_smbus_write_block_data, the first data byte isn't real data, instead in indicates how many bytes follow until the end of the block. It should result in "5D W 11 33 44" in your case though, not sure why you get "5D W 11 03 33" instead.

i'm aware of the length field and i2c_smbus_write_i2c_block_data doesn't work, too. Now i get: 5D W 11 44

unsigned char values[3];
int reg = 0x11;
values[0] = 0x33;
values[1] = 0x44; i2c_smbus_write_i2c_block_data(fd, reg, 2, values);

If i change the third parameter (length) to 1 I get the 0x33.

I've no idea! :-(

Regards,

Nick

      __________________________________________________________

Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#2 lore raw
In reply to a message not in the archive

Hi Nick,

Quoted 9 lines · Nick Teen
Quoted 5 lines

You probably want to use i2c_smbus_write_i2c_block_data instead. With i2c_smbus_write_block_data, the first data byte isn't real data, instead in indicates how many bytes follow until the end of the block. It should result in "5D W 11 33 44" in your case though, not sure why you get "5D W 11 03 33" instead.

i'm aware of the length field and i2c_smbus_write_i2c_block_data doesn't work, too. Now i get: 5D W 11 44

Quoted 7 lines

unsigned char values[3];
int reg = 0x11;
values[0] = 0x33;
values[1] = 0x44; i2c_smbus_write_i2c_block_data(fd, reg, 2, values);

If i change the third parameter (length) to 1 I get the 0x33.

Ah, you're in user-space, using i2c-dev? You should have told us so.

Quoted 1 line

I've no idea! :-(

I don't remember any similar problem, so no idea either. I can only suspect that your bus driver is doing something wrong. So please give us the detail of your setup:

* Which version of i2c-dev.h are you using?
* What architecture are you working on?
* Which kernel version are you using?
* What i2c bus driver are you using?
* How do you know for sure what actually goes on the bus?

Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c