I’m trying to communicate with an I2C chip which returns the length of the bytes to be read in the first byte of the transaction. This is fairly straightforward on most primitive microcontrollers.
But for the life of me, I cannot figure out how to do this on Linux. A “read” always wants to put a stop bit after the transaction. I see “I2C_M_NOSTART” which is probably what I need for the data bytes, but I don’t see a corresponding I2C_M_NOSTOP which is what I need for the first byte.
Any help would be appreciated. Thanks.
What I need is this transaction sequence:
(PROBLEM HERE–master processes length byte)<data_byte:0x01>
Under NDA. So, not in linux database.
Erm, unless you mean board. I’m using a Beaglebone Black Rev C running debian.
Linux beaglebone 4.9.36-ti-r46 #1 SMP PREEMPT Tue Jul 11 21:05:08 UTC 2017 armv7l GNU/Linux
Looking at the driver at: https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-davinci.c
It looks like i2c_davinci_isr() only terminates a read via terminate_read() which doesn’t seem to have an exit path for completion without STOP.
It would be nice if somebody with more experience than me could verify this, as I’m going to have to go to a bit-banged driver otherwise.
Sounds like another goofy TI I2C (USB-C part?) slave interface.
Two thoughts …
Is the part smart enough to send a “STOP” after it has transferred the (variable) length read? Or does it just keep going?
If the part is smart enough to send a stop when it is done, wrap an error handler around a [equal to maximum} byte read transfer, and let it exit gracefully on the error condition when the part sends a “premature” stop.
Then process what it gave you.
Worst case, you always read the full maximum length buffer and process according to the initial byte length given.
Well, if the SMBus Specification Version 2.0 Section “5.5.7 Block write/read” is goofy then, um, okaaaaay …
However, since this appears to be a standard part of SMBus, now I really do wish to ask “How do I do this with the Linux I2C drivers?”
As I read the Linux SMBus drivers spec, AND the SMBus Specification Version 2.0 Section “5.5.7 Block write/read”
The block write contains the length of the block to write.
The Read block DOES NOT contain the length of the block to read.
The only parts I have ever seen that implement a length on the Block Read are some goofy TI USB-C devices.
See my previous email regarding what I suspect your options are.
I will correct myself.
The Linux SMBus drivers do not include the bytle length in the read function call.
The SMBus spec does describe a block read transaction byte length.
Have you tried to use the Linux drivers to see if they handle the length byte internal to the function call?
Otherwise try a maximum length read, and see what happens.