I'm looking for suggestions on how to control several (15) OnSemi CAT5259 i2c digital potentiomenters which have a nonstandard i2c addressing. I am familiar with standard 7bit addressing with the lowest bit defining read or write, however this particular digipot requires a full 8 bits of addressing, see the attached extract. Here there is no read/write bit, reading/writing is set in the following instruction byte.
The upper 4 bits of the slave address are fixed (0101), with the lower 4 bits set by hardware address pins (A3 A2 A1 A0).
This allows upto 16 digipots to coexist on one i2c bus. My problem is that arduino wire library only allows writing to digipots with even adresses (A0=0), but cannot write to the odd numbered slave digipots since the r/w bit is automatically cleared when attempting a write.
Does anyone have suggestions on how to resolve this? I have 15 of these digipots sharing one i2c bus with an ESP32 master. I'd prefer not to split the pots accross two seperate buses but that is my last resort.
There are a bunch of bit-banging I2C libraries on the web. Maybe there's one made to drive an 8-bit address.
Don't know if it'll work, and would introduce its own complications but, you could hardwire all A3-A1 to whatever and use A0 as a bastard chip select. Drive all the A0s with a 4-to-16 line decoder/demultiplexer. The digipot with A0 low is the one you're addressing. Drive the decoder with four I/O pins.
Can you buy normal digital potentiometers ?
The CAT5259 is an example how not to make a I2C device. What a terrible way to bother users with something that will not work on any platform with common I2C functions.
In the datasheet they call it a I2C interface, but that is not according to the I2C standard. I think they are not even allowed to call it I2C.
Here is a list of software bit-banging I2C libraries for Arduino: Arduino I2C libraries · Testato/SoftwareWire Wiki · GitHub.
The SlowSoftWire by felias-fogg is the most basic library, it uses compatible Arduino functions (works on all boards) and it has no optimizations for speed or special things.
Thanks for the suggestions Chaps. I'm kind of stuck with with this digipot, I need 4 channel pots supporting upto 16 devices on a single i2c bus, which is very rare. It'll teach me to dig deeper into the datasheet in future and not trust 'i2c compliant' adspeak.
To avoid a hardware change ( don't fancy rewiring all the address lines) I'll investigate the bitbanged i2c librarys as suggested by Koepel otherwise, it's harware mod time...