I2C Master with limited transmission sizes
Hi,
I'm currently writing a driver for a cheap usb-to-i2c master device, which unfortunately can only write 31 bytes (+slave addr) and read 32 bytes.
What is the correct behavior if a user requests larger read/writes? Simply set i2c_msg.len to the bytes transmitted?
(in this case i2cdump -i doesn't honor this length ?)
Or should the master try to split up the requests? but if so how, as some devices don't support continuous reads.
Thanks,
Peter
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 3 lines
I'm currently writing a driver for a cheap usb-to-i2c master device, which unfortunately can only write 31 bytes (+slave addr) and read 32 bytes.
Which one?
Quoted 2 lines
What is the correct behavior if a user requests larger read/writes? Simply set i2c_msg.len to the bytes transmitted?
No!
Quoted 1 line
Or should the master try to split up the requests?
If you have control over sending start/stop bits, you could omit the stop condition unless you transfered all of the 32 byte chunks and issue the stop at the end.
If you can't, don't advertise I2C_FUNC_I2C, but SMBUS functions (without the block functions again). That will work for most devices.
Hope that helps,
Wolfram
Hi Wolfram,
thanks for your answer.
Quoted 5 lines
Quoted 3 lines
I'm currently writing a driver for a cheap usb-to-i2c master device, which unfortunately can only write 31 bytes (+slave addr) and read 32 bytes.
Which one?
CH341 based ones like this one http://wch-ic.com/download/down.asp?id=114
They go for about ~12 USD on ebay so quite affordable.
lsusb shows it as
ID 1a86:5512 QinHeng Electronics CH341 in EPP/MEM/I2C mode, EPP/I2C adapter
Quoted 3 lines
If you have control over sending start/stop bits, you could omit the stop condition unless you transfered all of the 32 byte chunks and issue the stop at the end.
This should be possible - I'll give it a try.
Once I've finished my testing I'll post it here for review.
Thanks,
Peter