This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Accessing external I2C EEPROM with Cypress EZ-USB dev kit

Hi

I'm trying to add an external EEPROM to my Cypress EZ-USB NX2LP-Flex dev kit, and accessing it using the library functions EZUSB_ReadI2C(), EZUSB_WriteI2C() and EZUSB_WaitForEEPROMWrite().

I plugged in a new 2Kbit EEPROM in the DIP socket and thought it was the only EEPROM there, and I tried reading it at address 0xA0, and was able to get all 0xFFs. I tried to write a single byte to the EEPROM with the following code:

   BYTE xdata temp1;
   BYTE xdata temp2[8];
   BOOL wrOK = FALSE;
   temp1 = 0x01;
   while (!wrOK)
      wrOK = EZUSB_WriteI2C(0xA0,0x01, &temp1);


I then read to read 8 bytes back with the following code

   EZUSB_ReadI2C(0xA0,0x08, &temp2);


Instead of getting all 0xFF except for the 1st byte, I got all 0x01.

I then realized that there are more than 1 I2C EEPROM connected to the SDA/SCL lines, so I'm wondering how do I address the correct one? And once I do that, how do I specify the memory address within the chip? I know the device address for all EEPROM starts with 1010(0xA), but I'm confused as to the later 4bits.

Thanks.

Parents
  • yes.

    I had a look at the datasheet and the PIG guys have confoooosed the defecation out of this.

    the 8 pin packages have A0. A1, A2 pins. A0, A1 are meaningless and A2 is not used (It should be to allow 2 such devices on the bus).

    Oh, well, the joy of using Microchip devices.

    I did not even know that a chip "addressed like 4 chips" existed. The EEPROMs I use (Ramtron) have a 2 byte memory address and A0-A2 are live allowing 8 devices on the IIC bus.

    Erik

Reply
  • yes.

    I had a look at the datasheet and the PIG guys have confoooosed the defecation out of this.

    the 8 pin packages have A0. A1, A2 pins. A0, A1 are meaningless and A2 is not used (It should be to allow 2 such devices on the bus).

    Oh, well, the joy of using Microchip devices.

    I did not even know that a chip "addressed like 4 chips" existed. The EEPROMs I use (Ramtron) have a 2 byte memory address and A0-A2 are live allowing 8 devices on the IIC bus.

    Erik

Children
  • Let me see if I understand you correctly.

    1) So in the olden days, the 3bits are used to select up to 8 IIC EEPROM devices on the same bus. However, once these devices started getting bigger than 256bytes, these 3 bits are actually used to select up to 8 256byte blocks?

    2) Since my device is a 1KB chip that's made up of 4 blocks, I am able to use the device address to actually address individual blocks within the chip?

    3) Since my device only has 4 blocks, I can actually use A2 to allow for 4 more blocks(can be another 1KB device, or 2 512byte chips, or 4 256byte chips, etc.)?

    4) I set the actual device address of the chip by pulling A2 up/down, hence setting it's address 10101XX or 10101XX.

    5) Actual word addressing would have to be done by some function other than EZUSB_WriteI2C() & EZUSB_ReadI2C() since these functions only allow device address as input parameters and not word address?

    Thanks!

  • 3) Since my device only has 4 blocks, I can actually use A2 to allow for 4 more blocks(can be another 1KB device, or 2 512byte chips, or 4 256byte chips, etc.)?

    4) I set the actual device address of the chip by pulling A2 up/down, hence setting it's address 10101XX or 10101XX.

    ... my quick read of the datasheet seems to indicat that A2 is ignored.

    You can use whatever you want, but for certainity of supply I would use an EEPROM with standard format (I use Ramtron - yes single supplier but, since the access format is standard, I can use any similar EEPROM in a pinch, just do not get the resiliance (which I can live without, but prefer and like)).

    Erik