Nicolai-Electronics / rp2040-i2c-interface

MIT License
219 stars 28 forks source link

SMBUS communication #5

Closed improvisor40 closed 11 months ago

improvisor40 commented 1 year ago

Hello, does the driver support i2c to smbus communication, as I heard they both are not fully compatible (i2c - smbus). But I want to know if the driver simplify/bridges that gap?. As I plan on using an i2c master on an smbus slave to write commands and recieve alerts to and from its eprom!. Thanks

nonchip commented 1 year ago

this isn't the driver, but yeah the linux one registers as a smbus adapter.

summarizing the wikipedia summary, essentially smbus from a hardware POV is a "subset" of i2c, because it specifies slightly stricter rules than i2c (such as simply not supporting the fancy highspeed modes, defining voltage levels etc). the rp2040's i2c hardware fully supports smbus (and more). now from a software POV it defines a bunch of protocols which this adapter knows nothing about, but shouldn't have to, because (at least on linux) that's the job of the overall smbus/i2c subsystem.

according to the code you didn't read, the adapter supports I2C_FUNC_SMBUS_EMUL, which according to the kernel docs you didn't google:

Handles all SMBus commands that can be emulated by a real I2C adapter (using the transparent emulation layer)

note i have no idea how you're planning to "receive alerts from its eprom" given an eprom is a readonly storage device and even the EEPROM/flash you meant are just storage either, but if you need SMBALERT# or the multimaster "host notify protocol" you of course need additional hard- and software support, but those are both optional features in smbus.

so as long as you keep your software stuff to spec, i don't see why this wouldn't speak smbus as literally advertised to the OS on plug-in, and you didn't say anything to the contrary except "I heard", sooooo um sorry but why does this issue exist? :P

improvisor40 commented 11 months ago

Closed for clarity reasons!.