EEPROM memory/Making it last/10. When it does not answer
Making it last · 10 of 10

When it does not answer

The board has no light, so the first test is a scan: a few lines that call every I2C address and list the ones that answer. If 0x50 is not on the list, it is the wiring. If it is, the fault is in the sketch: a read too soon after a write, a write across a page edge, one address byte instead of two, or a byte written too often.

Six symptoms

When it does not answer
What you see
The chip does not acknowledge 0x50. Count from the square pad: GND, VCC, SDA, SCL. The usual fault is SDA and SCL swapped, which answers nothing and harms nothing. Then check VCC is really there, and that the I2C PULL-UP jumper on the back has not been cut with no other pull-up on the bus.

Pick what you see. The ringed part of the board is where to look, and the sentence under it is the check to make.

The scan

Every check starts here. This loop calls each address from 1 to 126 and prints the ones that acknowledge:

for (int a = 1; a < 127; a++) {
  Wire.beginTransmission(a);
  if (Wire.endTransmission() == 0) {
    Serial.print("found 0x");
    Serial.println(a, HEX);
  }
}

Put it in setup() after Wire.begin(), with Serial.begin(115200) before it. The TK31 prints found 0x50. In MicroPython, print(i2c.scan()) does the same and prints [80], which is 0x50 in decimal.

Not found: the wiring

Swapped SDA and SCL is the usual fault, and it harms nothing. Count from the square pad: GND, VCC, SDA, SCL. Then check your board's pins: A4 and A5 on an Uno, GPIO 21 and 22 on an ESP32, GPIO 8 and 9 on an ESP32-S3, GP4 and GP5 on a Pico.

Then VCC: on your board's logic supply and actually connected. And the jumper on the back: if it has been cut and nothing else on the bus has pull-ups, SDA and SCL float and nothing answers.

Two TK31s on one bus both answer at 0x50 and the scan shows one. There is no way to move one of them; give it its own bus.

Found, but the data is wrong

Old values, or 255 after a write: the read went out while the chip was still writing. Wait after every write, with delay(5) or acknowledge polling.

255 everywhere, even after a write that waited: the sketch or library is sending one address byte instead of two, so it reads and writes somewhere else. Libraries for the small 24C02 do this.

Text with its end at its start: a write crossed a 64-byte page edge and wrapped. Sixty-four-byte pages has the fix.

One byte that will not hold: wear. A million writes finds the loop that did it.

When it does not work

The scan finds 0x50 and also something else.

That is another I2C device on the same bus, which is fine as long as it is not also at 0x50. An SHT31 block, for example, answers at 0x44.

The scan finds nothing at all, not even my other blocks.

Suspect the bus rather than the TK31: SDA and SCL swapped, the wrong pins for your board, or no pull-ups anywhere because a jumper was cut. Check GND is shared with your board, too.

Could 5V on VCC have damaged my 3.3 V board?

It held the board's SDA and SCL pins above their rating, through 10 kΩ, which keeps the current to a fraction of a milliamp, so the pins may well have survived. Move VCC to 3V3 and test those pins with something else before trusting them.

Can the chip be damaged by the sketch?

Only by wear: about a million writes to one byte. No sequence of reads, and no write to the wrong address, harms the chip. At worst a sketch overwrites data it meant to keep.

Where this goes next

The pins, the wiring and the limits on one page, for when you only need to look something up.

The EEPROM Memory reference page

Edit this page — content/books/eeprom-memory/when-it-does-not-answer.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

EEPROM Memory

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum