I'm working on setting up an interface between an Arduino Pro Micro and a few MAX6958 LED drivers. This driver works as an I2C slave. I need to control quite a number of these chips (like 7-10), but at least my application can withstand sending commands to each driver sequentially (i.e. only one I2C line has to be operating at any given instance).
The MAX6958 datasheet talks about multiple masters, but what about the case of multiple slaves?
What I had envisioned was a circuit where I have the SDA line tied form one of my arduino's digital outputs, but separate SCL lines to each LED driver. That way, only the LED driver with the active SCL is the one which receives data.
With the SoftwareI2CLibrary it seems that the SCL line is set with a constant
Since this is value is set during compiling, I'm wondering if there is a way to implement the SCL pin configuration in software, and allow it to be change in the code, or if there are other ways to approach an alternative solution?
Thanks
EDIT: I should add that it is only possible to put a max of 2 MAX6958 drivers on any one bus as a function of whether the chip is hardwired internally for the slave address to be one of two possibilities. So traditional slave addressing isn't possible as far as i can tell with these LED drivers.
brNeuro:
The MAX6958 datasheet talks about multiple masters, but what about the case of multiple slaves?
(...)
EDIT: I should add that it is only possible to put a max of 2 MAX6958 drivers on any one bus as a function of whether the chip is hardwired internally for the slave address to be one of two possibilities. So traditional slave addressing isn't possible as far as i can tell with these LED drivers.
So, you answer you own question. The multi-slave is possible up to 2 slaves per bus.
EDIT: Maybe you can find some other device that can do what you want and with address programming.
luisilva:
So, you answer you own question. The multi-slave is possible up to 2 slaves per bus.
well, not really, no... i'm asking how to make it work, not how to make it not work.
As I said in my initial post, I understand the limitation using the traditional slave addressing is 2 per bus. I'm looking for a parsimonious way to run a few i2c buses, sequentially, on different pins.
luisilva:
EDIT: Maybe you can find some other device that can do what you want and with address programming.
I have these devices, I'm not looking for a whole rework, I'm looking for info how to make these work with the equipment I've got.
You cannot really run I2C on differnt pins. Wel...you dan because there are software I2C bus implementations around that bit big pins, but that comes at a computational price.
You can find I2C bus multiplexers though that at would allow you to to what you want with the existing two I2C pins.
One such I2C multiplexer I already worked with is the TCA9548A:
You get 8 I2C buses which you can select over I2C. So with 2 addresses per bus you can attach 16 MAX6958 to your Arduino and still need only the two I2C pins.
thanks for those suggestions on the i2c multiplexer. I just decided to go ahead and make my own parallel i2c code. It loops through setting SDA pins for each device and bit sent, and pulses a common SCL line shared by all slave devices. I'll keep in mind the multiplexer for future projects.
You are aware that the I2C interface is a bit more complex than an SPI where you just bit-bang a byte out of a pin synchronized by a clock signal. You might have to handle things like start and stop condition, clock stretching, getting acknowledges, etc. Doing that for 7-10 buses will slow down your application considerably.