Microchip 24C02C EEPROM read/write problems

Hello

I currently have an 24C02C to program, i have multiple hardware programers but only one is capable of read (SkyPro), when i try to write it say success but when i verify it come with a error message "Verify Fail![Address:00000053H;Buffer:60H;Chip:00H]" no matter what i change... And chip cotents will not change.
And yes i connect WP (Write Protection) to GND

So after many tries i move to arduino and connect all wires, write a small program using this functions: Arduino Playground - I2CEEPROM

I had no success, but my attemps make chip blank
After many searchs i found other code that i try (I lost the link) so i will post all the code

Program 1
Program 2
(Code is outside this post because (9000 characters) max allowed)

I have used 1K pullup on SCL and SDA lines as i saw on internet, but the result is the same

Program 2 read all FF while program 1 read real chip content but none write as i want. I don't know if i'm doing it well.
I want to write variable "somedata" contents into chip.

Current chip contents:

Can you program a different EEPROM type?

aarg:
Can you program a different EEPROM type?

On hardware programers Yes, on arduino not tested.
Currently only have 25 SPI spare ROMs, but the one i need is 24 I2C type and i only have this one.
ROM come from a car controller

Using your SkyPro tool:

Your screen dump shows that you have the "size" set to 256 bytes. The size of the 24C02C is 2048 bytes.

Your screen dump shows that you have the "page size" set to 8 bytes. The page size of the 24C02C is 16 bytes.

Set your device size and page size correctly and try it again, post your results if it fails.

Are you certain that device is a 24C02C? According to the Microchip docs, the SOIC should have the full 24C02C printed on it.

Hi,
I only checked the Program 2 and have a few question:

 for(byte i = 0; i < 16; i++)
  {
    writeEEPROM (rom, i, somedata[i], sizeof somedata[i]);
  }

Won’t the EEPROM address overlap when you are writting 16bytes and only increment the address by one ?

byte readEEPROM (byte device, unsigned int addr )
  {
  byte temp;
 
  if (readEEPROM (device, addr, &temp, 1) == 0)
    return temp;
 
  return 0xFF;
 
  }

Can you change the return error code so that we can see if you are really reading 0xFF from the memory or if an error occured ?

avr_fred:
Using your SkyPro tool:

Your screen dump shows that you have the "size" set to 256 bytes. The size of the 24C02C is 2048 bytes.

Your screen dump shows that you have the "page size" set to 8 bytes. The page size of the 24C02C is 16 bytes.

Set your device size and page size correctly and try it again, post your results if it fails.

PDF says: "The device is organized as a single block of 256 x 8-bit memory with a 2-wire serial interface"
256 x 8 = 2048

So i think is correct

I tested with settings you suggest and read/write both fail and not able to continue

avr_fred:
Are you certain that device is a 24C02C? According to the Microchip docs, the SOIC should have the full 24C02C printed on it.

Yes, as this is from a car they often hide real refs to people not able to find the IC, if you search for the printed ref on IC it will lead you to 24C02C

As i told Skypro is able to read and write to it, but write never happen, contents will not be modified or saved

JiaoJiao:
Hi,
I only checked the Program 2 and have a few question:

 for(byte i = 0; i < 16; i++)

{
   writeEEPROM (rom, i, somedata[i], sizeof somedata[i]);
 }



Won't the EEPROM address overlap when you are writting 16bytes and only increment the address by one ?



byte readEEPROM (byte device, unsigned int addr )
 {
 byte temp;

if (readEEPROM (device, addr, &temp, 1) == 0)
   return temp;

return 0xFF;

}



Can you change the return error code so that we can see if you are really reading 0xFF from the memory or if an error occured ?

Program 2 was my second attempt with multi byte write. Can you have a look at program 1? It write byte by byte.
I’m not sure how i must write to EEPROM or if i’m doing it the right way. If max address is 000000F0 (240) and im only write up to 16 it seens that i’m not filling it proper, but it should write something right? And dump always come with same result, almost empty.
So instead a for from 0 to 16 i must multiply counter by 16 right?

I will try your suggestion and post results

Program 1 Output is:

Wait for Wire
OK!
Write:
0xAA, 0x55, Cannot write to device0xAA, 0x55, 0xAA, 0x55, 0x38, 0x36, 0x36, 0x2E, 0x32, 0x37, 0x38, 0x36, 0x36, 0x2E,
0x32, 0x37, 0x3, 0x93, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x7F, 0x4A, 0x2, 0x0, 0xFA, 0xC5,
0xFA, 0xFB, 0xF8, 0xF9, 0xFE, 0xFF, 0xF2, 0xF3, 0xF7, 0xDF, 0xFA, 0x57, 0x3, 0x93, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xD0, 0x0, 0x3, 0x93,
0x2, 0x0, 0x28, 0x0, 0xE, 0x99, 0x0, 0x0, 0x0, 0x0, 0x0, 0x15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0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

I’m not sure why i get a Cannot write to device and if it affect the write procedure.
Should i try using 4.7K pullup on I2C Lines?

I was incorrect on the device size, yes, it is 256 bytes.

Have you tried the settings of 256 byte size, 16 bytes page size. These are the correct settings for the SkyPro.

I assumed you have removed the device from the board, is this correct?

avr_fred:
I was incorrect on the device size, yes, it is 256 bytes.

Have you tried the settings of 256 byte size, 16 bytes page size. These are the correct settings for the SkyPro.

I assumed you have removed the device from the board, is this correct?

I can't set manual settings on SkyPro, settings are set by chip ref.
16 bytes can't be set and don't exists in any of skypro chips, still it will lead a invalid size.
If you look at my screenshot, skypro have 16 rows and 16 cols (16*16 = 256) which mean correct setting

Yes i remove it from board and solder in a PCB that come with skypro it just expand chip to a normal Through hole mount

Look at skypro video: http://i.imgur.com/bfBzAh5.gifv

Both of your sketches are using 16 bit addressing, the datasheet shows that it should be 8 bit.

void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data )
{
  byte err;
  byte counter;

  Wire.beginTransmission(deviceaddress);
  Wire.write((byte)(eeaddress >> 8)); // MSB      <-- remove this line
  Wire.write((byte)(eeaddress & 0xFF)); // LSB
  Wire.write(&data, 1);
  err = Wire.endTransmission();

  // ... etc
}

This will need to be changed for all read and write functions.

Martin-X:
Both of your sketches are using 16 bit addressing, the datasheet shows that it should be 8 bit.

void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data )

{
  byte err;
  byte counter;

Wire.beginTransmission(deviceaddress);
  Wire.write((byte)(eeaddress >> 8)); // MSB      ← remove this line
  Wire.write((byte)(eeaddress & 0xFF)); // LSB
  Wire.write(&data, 1);
  err = Wire.endTransmission();

// … etc
}




This will need to be changed for all read and write functions.

Oh man that worked, thanks! ??? Using program 1 and 2, still first 2 bytes do not match…

Output:

Write:
0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0x38, 0x36, 0x36, 0x2E, 0x32, 0x37, 0x38, 0x36, 0x36, 0x2E,
0x32, 0x37, 0x3, 0x93, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x7F, 0x4A, 0x2, 0x0, 0xFA, 0xC5,
0xFA, 0xFB, 0xF8, 0xF9, 0xFE, 0xFF, 0xF2, 0xF3, 0xF7, 0xDF, 0xFA, 0x57, 0x3, 0x93, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xD0, 0x0, 0x3, 0x93,
0x2, 0x0, 0x28, 0x0, 0xE, 0x99, 0x0, 0x0, 0x0, 0x0, 0x0, 0x15, 0xC4, 0xC4, 0x50, 0x0,
0x4C, 0x0, 0x0, 0x60, 0x58, 0x4D, 0x0, 0x0, 0x0, 0x2E, 0x9, 0x44, 0x0, 0x0, 0xC6, 0x47,
0x0, 0x0, 0x55, 0x22, 0x0, 0x60, 0xA1, 0x60, 0x0, 0xC4, 0xC4, 0x50, 0x0, 0x4C, 0x0, 0x0,
0x0, 0x58, 0x4D, 0x0, 0x0, 0x0, 0x2E, 0x9, 0x44, 0x0, 0x0, 0xE3, 0xA3, 0x0, 0x0, 0x55,
0x22, 0x0, 0x60, 0xA1, 0x26,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 0x99, 0x0, 0x0, 0x0, 0x0, 0x0, 0x15, 0xC4, 0xC4, 0x50, 0x0,
0x4C, 0x0, 0x0, 0x60, 0x58, 0x4D, 0x0, 0x0, 0x0, 0x2E, 0x9, 0x44, 0x0, 0x0, 0xC6, 0x47,
0x0, 0x0, 0x55, 0x22, 0x0, 0x60, 0xA1, 0x60, 0x0, 0xC4, 0xC4, 0x50, 0x0, 0x4C, 0x0, 0x0,
0x0, 0x58, 0x4D, 0x0, 0x0, 0x0, 0x2E, 0x9, 0x44, 0x0, 0x0, 0xE3, 0xA3, 0x0, 0x0, 0x55,
0x22, 0x0, 0x60, 0xA1, 0x26, 0x0, 0x2, 0x0, 0xF7, 0xDF, 0xFA, 0x60, 0xAA, 0xFF, 0xE1, 0x1E,
0x4C, 0x8, 0x8, 0x0, 0x4, 0x28, 0x2, 0xF1, 0xA, 0x0, 0xA6, 0x7F, 0xA, 0x8, 0x2, 0x2,
0x0, 0x0, 0x28, 0xFF, 0x71, 0xAC, 0x85, 0x89, 0x6F, 0x17, 0x8, 0x8, 0x8, 0x0, 0x0, 0x28,
0xFF, 0x2B, 0x0, 0x1C, 0xAA, 0x7D, 0x8, 0x8, 0x2, 0x2, 0x0, 0x0, 0x28, 0x17, 0x0, 0x93,
0x2, 0xB8, 0xB7, 0x22, 0x4C, 0x80, 0x80, 0x0, 0x4, 0x28, 0x7B, 0x0, 0x0, 0x0, 0x82, 0x92,
0x2E, 0x44, 0x1, 0x1, 0x0, 0x4, 0x28, 0x1, 0x74, 0x0, 0x82, 0x0, 0x99, 0xB, 0x8, 0x10,
0x10, 0x0, 0x0, 0x28, 0x3, 0x5F, 0x61, 0x57, 0x9E, 0x6B, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,

Also after this SkyPro are unable to read the chip, but arduino can…

EDIT: i tried manual set bytes in program 1 and i got this result: “Cannot write to deviceCannot write to device”

i2c_eeprom_write_byte(device, 0, 0xAA);
i2c_eeprom_write_byte(device, 1, 0x55);
i2c_eeprom_write_byte(device, 2, 0xAA);

Error code is 2:received NACK on transmit of address

I would try Ack polling prior to the first write to make sure the device is ready.

Do the first 2 writes always fail regardless of the address or data written?

Martin-X:
I would try Ack polling prior to the first write to make sure the device is ready.

Do the first 2 writes always fail regardless of the address or data written?

No, the first writes works in any other address, only in the first two fail, no matter when i write.
Read is OK

I can only conclude that addresses 0 and 1 have failed, but returning error code 2 doesn't make sense, that would indicate a timing or wiring problem.

Martin-X:
I can only conclude that addresses 0 and 1 have failed, but returning error code 2 doesn't make sense, that would indicate a timing or wiring problem.

What can i try? Is it possible that addresses are corrupt? Or my first attempts damage that sectors?
I'm now with 4.7K pullups, but before with 1K and old 16bit code it had same problem, when try to write to that address i got the same error

Memory chips do have a limited life span, so a failure of individual bytes or bits is a possibility.

Wire.endTransmission() returns 2 when the chip fails to acknowledge its own device address (0x50) being sent. This would not be the case for a particular memory address, as this error is returned before the memory address has been transmitted. Microchip’s documents do not state that a failure to write will return an error, only that a read back will show a mismatch. In other words, a memory failure won’t return error code 2.

Write a new sketch which tests the first five memory locations. Write to the addresses in descending order, storing new values (to prove the write). Use Serial to show the address, value to write, return value of endTransmission() and the read-back from that address. And finally, post the sketch here on the forum.

Martin-X:
Memory chips do have a limited life span, so a failure of individual bytes or bits is a possibility.

Wire.endTransmission() returns 2 when the chip fails to acknowledge its own device address (0x50) being sent. This would not be the case for a particular memory address, as this error is returned before the memory address has been transmitted. Microchip's documents do not state that a failure to write will return an error, only that a read back will show a mismatch. In other words, a memory failure won't return error code 2.

Write a new sketch which tests the first five memory locations. Write to the addresses in descending order, storing new values (to prove the write). Use Serial to show the address, value to write, return value of endTransmission() and the read-back from that address. And finally, post the sketch here on the forum.

Ok i will try that and post results.
Also today the customer bring me other board with same chip to test. Same happen with fresh chip. 2 first bytes fail