Pages: [1]   Go Down
Author Topic: initialize multiple i2c slaves with the same address  (Read 874 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to use 4 quad dacs on 1 i2c bus. The quad dacs are MCP4728 with programmable i2c addresses (http://ww1.microchip.com/downloads/en/DeviceDoc/22187a.pdf)
Is it possible to start with equal addresses on 1 bus and then programm the address of each slave by using a separate LDAC pin, 4 pins, 1 for each dac? Or is it impossible to use the i2c bus with multiple slave with the same address (all slaves will acknowledge on the same time)?
Logged

Offline Offline
Edison Member
*
Karma: 31
Posts: 1417
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The chips are all initially programmed with the same address having the low order three bits set to 000 in their EEPROM.
You would have to put them on the I2C bus one at a time, program a unique low-order address into the EEPROM for each of them. Then you can use use them all at the same time on the I2C bus.

Pete
Logged

Where are the Nick Gammons of yesteryear?

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What happens if you put the chips on the I2C bus with the same address? Is it impossible to write the addresses one by one for this case?
Logged

Offline Offline
Edison Member
*
Karma: 57
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is impossible to use more than one device with the same I2C address. I do not know what will go wrong, that depends on the hardware of the chip, but it will go wrong.

I have been reading the datasheet about the LDAC pin. They say that it can be used, but it is not clear to me how it can be used to set the address in EEPROM with a few chips on the same I2C bus.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at figure 5-11 in the datasheet. I know the current address (which is 000 for unprogrammed dac's), so the master can send these bytes. The address changes only for the device where the ldac pin makes a transition from high to low during the negative pulse of the 8th clock of the 2nd byte, which is also controlled by the master. I don't know if the acknowledge bits will interfere with the stream.

I am considering a question to Microchip, but am still looking for the right support channel.
« Last Edit: September 04, 2013, 03:32:05 pm by Oldchatterman » Logged

Offline Offline
Sr. Member
****
Karma: 7
Posts: 264
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As mentioned in a previous post you need to connect one MCP4728 to the I2C bus one at a time to program the Address.

Also there is a peculiarity that has to do with the LDAC pin and the timing that will make programming difficult. This article will explain details on how to accomplish this http://neuroelec.com/2011/02/soft-i2c-and-programmable-i2c-address/
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In my case it must be possible to programm the adresses without the "hassle" of putting jumpers in a certain sequence. I can think of 2 options to eliminate this problem:
1. make it possible to power up the dacs by the MCU
2. use the fixed factory defined address in combination with a multiplexer

Would a 74HC4052 multiplexer be a good solution in this case?
Logged

Offline Offline
Edison Member
*
Karma: 31
Posts: 1417
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would try the software described in the link Headroom gave. A multiplexer will probably be just as complicated as trying the software I2C library.
You could use the software I2C library to set the addresses of each device. If the library works, this would be a one-time thing. Then use the regular I2C library (which uses the hardware I2C) for normal use of the chips.


Pete
Logged

Where are the Nick Gammons of yesteryear?

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried the software from the link, but was not able to change the address. After removing 3 of 4 dacs I was able to send setpoints to the dac, but still no luck in changing the address. The dac listens to address 0, but when I read the address it responds with address 7. I use An atmega328 on a 8 mHz clock and 3v3 supply. The vdd of the dac is 5v. I don't want to debug the specific address changing sequences for this dac.
What i2c multiplexing options would be a good pick?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Another option would be to use a pca9548:
www.kerrywong.com/2012/10/08/i2c-multiplexer-shield-testing/

Any advice?
Logged

Pages: [1]   Go Up
Jump to: