View Full Version : eeprom and i2c bus, speeds, master and slave.

03-12-2012, 10:01 PM
Ok so I am looking at this eeprom its 512k 400khz/1mhz


W (http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&itemSeq=111909704&uq=634671677330153641)hat im wondering is basically how do you ensure your chip is communicating at the top speed in this case 1mhz. From the data sheet it looks like as long as it is at a constant 2.5 to 5.5 volts it will operate at 1mhz? So can i power it with a 3.3v regulator or does that mean the low signal has to be 2.5v and the high 5.5v? Do the pull up resistors have any bearing on frequency? One of the eeproms data sheets that parallax sells says to use a 10k resistor instead of 10k when operating at 1mz.

Also when chaining things on the i2c bus how is this done. I looked at a gadget gangster board that has a spot for an extra eeprom. Its wired the same as all the parallax stuff. There are two eeprom slots that are wired in parallel in the same manner as all the other standard schematics except the slaves(2nd eeprom) A0 pin is connected to the 3.3v power, instead of ground. Can someone explain to me why you would hook the address pin of the slave to the power, if you were to put a 3rd chip in parallel where would you stick its a0 pin?

Im just trying to basically get two eeprom chips wired correctly which im assuming the GG prop board does the right way, but i want to make sure they are operating at 1mhz too, I want to get the fastest infastructure i can for the memmory, i mean i read the read on eeprom can be like 5ns when at 1mhz now thats super fast and will ensure any data stored there will be super quick.

Mike Green
03-12-2012, 10:34 PM
The 400kHz/1mHz is a maximum speed. The actual speed that an I2C device uses depends (in the case of the Propeller) on the code since that sets the actual timing. The voltages given (1.8V / 2.5V / 3.3V / 5.0V) are the power supply voltages. With a 3.3V supply, pretty much any EEPROM will work with a 1MHz clock or anything slower. There's some interaction between supply voltage, distance for the signals to go, and pull-up resistor values. The original Phillips I2C spec called for 4.7K resistors. In most cases, 10K will work fine.

Different I2C devices have to have unique addresses. The An pins allow you to specify an address for the device. Most devices allow for a default address of 0 if no address pins are connected or they're connected to ground (Vss). Typically a 2nd device will have address 1 and its A0 address pin is connected to Vdd to make this so. If you want additional devices, you connect the address pins to create the addresses you want. Usually they're sequential. Note that there are additional address bits for different kinds of devices so there can be an address 0 for an EEPROM and an address 0 for a real-time-clock and they're unique and separate.

Like I said, the actual speed depends on the code you use. Something like the "Basic_I2C_Driver" object that's written in Spin won't get anywhere near 400kHz. My assembly driver that's used in FemtoBasic and other objects will run a bit faster than 400KHz at best since the code is written to allow for a variety of I2C devices and the generality slows it down. You could write your own routines in assembly that could easily run at 1MHz, but they'd need to be written specifically for use with EEPROMs.

03-12-2012, 10:41 PM
Ok thats good to hear then, the speed is a code thing im not worried about code right now just building a hardware infrastructure that will support the fastest communication possible when it comes time to start learning the code part of things.

Now as far as addressing im assuming you would do all ground master A0 power, slave 1, a2 power only slave 3, up to i guess all A pins connected to voltage would be 7? 1+2+3, basically conect the pins and count the address in binary, i.e a0 and a2 have power would be address 4?

Dave Hein
03-12-2012, 10:43 PM
You could use the pasm_i2c_driver in the OBEX, which is based on Mike's basic_i2c_driver, and uses the same calling interface. There is a parameter that controls the bus speed and it can run at 1 MHz with no problem.