EcmaTC53 / spec

Ecma TC53 spec work
23 stars 9 forks source link

What is SMBus? #33

Open tve opened 1 year ago

tve commented 1 year ago

I know that SMBus refers to the System Management Bus with specs found at http://www.smbus.org. This post may come across as pedantic even though that's not my normal style, but I'm wondering how the SMBus Class in the ECMA-419 spec relates to the standard and I believe this does need clarification. I normally don't care too much about such details, but I'm trying to wrap my mind around atomicity and the proposed async modes of the I2C and SMBus classes and the questions about "what is SMBus?" is related to that but I thought I'd split it out.

Anyway, the SMBus standard has sections about the physical layer, sections about the protocol, and in there a section about address resolution (and there's probably some more that I'm ignoring). Some observations I've made:

I have written several dozen drivers for I2C devices (not using Javascript) and a majority uses SMBus-like reading and writing of registers, but I have never used an "SMBus" library or bus driver in the process, I have always used I2C. If I want to use ECMA-419 async then for devices that use an "SMBus-like protocol" but that do not state anywhere that they are SMBus compliant I may have to use the SMBus class in order to get atomic read-register operations, but it leaves me wondering whether that's a correct use of the SMBus class or whether I may run into incompatibility issues.

I suspect that the intent of the ECMA-419 SMBus class is to support the very common "SMBus-like protocol" (maybe "SMBus network layer bus protocols" is the correct term looking at the spec?) and that "details" such as timeout and address ack are handled "leniently". Anyway, I do believe that ECMA-419 should be a little more precise about what the SMBus class refers to, even if that is a bit pedantic.

(I'm actually wondering whether it would not be better to fold the SMBus-like register access methods into the I2C class and side-step the whole issue. At least that's what some other libraries do.)