gobot icon indicating copy to clipboard operation
gobot copied to clipboard

i2c/smBus ReadBlockData() not implemented

Open gen2thomas opened this issue 3 years ago • 1 comments

According to the Kernel specification it should be possible to implement this function. The opposite "WriteBlockData()" is still implemented.

Following drivers could be simplified:

gen2thomas avatar Sep 04 '22 11:09 gen2thomas

That sounds like a great idea!

deadprogram avatar Sep 06 '22 08:09 deadprogram

While rework of PCA9501 i2c driver (see #786 ), I found that all implementations of Read*Data() in digispark (and also in firmata) are wrong implemented, regarding to the Kernel specification and the implementation of sys-fs driver.

Read Byte (Comm==Register) S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P We have implemented in "ReadByteData()": S Addr Wr [A] Comm [A] P S Addr Rd [A] [Data] NA P

Read Word S Addr Wr [A] Comm [A] Sr Addr Rd [A] [DataLow] A [DataHigh] NA P Implemented in "ReadWordData()": S Addr Wr [A] Data [A] P S Addr Rd [A] [DataLow] A [DataHigh] NA P

In general most chips support both sequences, but unfortunately not all, e.g. PCA9501, which only support the "Read Byte".

At least the littlewire interface, used for digispark, support the skip of stop condition ("P"), so the change is generally no problem.

gen2thomas avatar Oct 01 '22 10:10 gen2thomas

Hi @deadprogram , because I'm not familiar with firmata in general and with client "writes an arbitrary Sysex command to the microcontroller" in special, I'm just marked the wrong implemented commands with an TODO and will create a new issue for this special behavior.

gen2thomas avatar Oct 01 '22 16:10 gen2thomas

part of release v2.0.0

gen2thomas avatar May 15 '23 16:05 gen2thomas