Wednesday, March 15, 2017

Linux - getting the LTC4317 to work

The LTC4317 is an amazing chip, in that it simply translates I2C addresses so you can cram more things like accelerometers on a single i2c bus for the Raspberry Pi3, or whatever. This was a horrible complex setup, that I got working 6 months ago, and it took me another day recently to remember what I did. That is why I am outlining it on my blog. There was no help available when I searched.

The chip itself is a teeny-weeny thing, meant for surface mounting, and an amateur like me can't handle it. The specs are here.

So, you go for a breakout board. This is a fairly new chip, so the board is expensive. It turns out that this board was made for a particular purpose, and has everything set up for a particular address shift.

Just figuring that out nearly kills you, but it turns out to be great. The chip has a complex means to shift addresses involving split resistors of 1% tolerance. You could never easily get these things, but the board does it for you. So, the first bus adds a little bit and the second adds more. That means I can get an additional 4 adxl345's to the original 12c bus. There are bus multiplexers, but that's more programming.

Zero documentation doesn't tell you that the enable leads have to be put high, or the output needs pullup resistors. You get some of that from the original specs, but it's all a mess.

I got it to work, again. There's something weird with the output pullups, they have to be between two leads. But maybe that's superstition.

Note that en1 and en2 need to be high. I also had a lot of trouble with the current injectors for the output scl and sda. Whew!

I'm going with adxl345's because they work simply with smbbus, and you cannot mix bit-banging with these. These are failed breakout boards that I got cheap. You have to knock out r4 to get a second address. You can get these by the bucket-load directly from China.