hybridgroup / gobot

Golang framework for robotics, drones, and the Internet of Things (IoT)
https://gobot.io
Other
8.92k stars 1.04k forks source link

i2c/smBus ReadBlockData() not implemented, all "Read*Data()" of digispark and firmata are wrong implemented #832

Closed gen2thomas closed 1 year ago

gen2thomas commented 2 years ago

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

Following drivers could be simplified:

Some notes for support of block-read:

deadprogram commented 2 years ago

That sounds like a great idea!

gen2thomas commented 2 years ago

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 commented 2 years ago

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 commented 1 year ago

part of release v2.0.0