Inky wHAT I2C

I’m trying to port the Inky library over to C++ so I can use it from an ESP32 using the Arduino tool set. All great journeys begin with a first step and in this case that first step is to try to query the EEPROM using I2C.

Using the Inky code as a reference it appears that the device has an I2C address of 0x50. It also appears to initially write a 0 to that address (not sure why) (inky/eeprom.py at fa59811bb5a9aad9eac82da3e58b6dc2ead75b8c · pimoroni/inky · GitHub) and then it reads 29 bytes which the first seven contain the width, height, colors, PCB version, and display version (inky/eeprom.py at fa59811bb5a9aad9eac82da3e58b6dc2ead75b8c · pimoroni/inky · GitHub).

After many attempts I was only able to see good data once, maybe twice (400x300, 3, ?, ?). All of the other reads I end up with bogus data, generally FFFFFFFF, FFFFFFFF, 255, 255, 255.

What could I be missing?

Thank you,
Brad

Might want to poke around over at Adafruit, they use E-Ink displays on various micro controllers.
For example:
Overview | Adafruit Circuit Playground Tri-Color E-Ink Gizmo | Adafruit Learning System
And,
Adafruit Learning System

You might get lucky and find a working library, or one that only needs some modifying.

I tried disconnecting the ribbon cable and then attaching it to an Adafruit eInk Breakout Friend (Adafruit eInk Breakout Friend with 32KB SRAM : ID 4224 : $8.50 : Adafruit Industries, Unique & fun DIY electronics and kits) but didn’t have much luck. The API behaved as if it was talking to the eInk Breakout Friend but I didn’t see any results on the display so I reverted it.

Thought I would try to port the code for the Inky library. It looks pretty straight forward but I’m running into this very first issue where I can’t verify that I’m properly talking to it (via I2C).

I purchased an Adafruit eInk Feather Friend (Adafruit eInk Feather Friend with 32KB SRAM : ID 4446 : $8.95 : Adafruit Industries, Unique & fun DIY electronics and kits) and might try the ribbon cable thing again. We’ll see. I would still like to port the library and I think it could be really useful to others who would like to use an ESP32 instead of a RPi. For me it’s about the power management.

Doesn’t the Inky wHat use SPI? I could be wrong but I do believe i2c is just used to read the ID eprom?
The other E-Inks you listed all look to also be SPI?

It does use SPI, that is correct. I haven’t gotten that far yet. The Inky library uses I2C to read the EEPROM to get the information about the display. This is what I posted about above and the problem I’m having. I too am trying to read the information from the EEPROM and generally get 0xFF for all reads.

The code to read the EEPROM in the Inky library:

eeprom.py
130:        i2c_bus.write_i2c_block_data(EEP_ADDRESS, 0x00, [0x00])
131:        return EPDType.from_bytes(i2c_bus.read_i2c_block_data(EEP_ADDRESS, 0, 29))

My code:

    Wire.beginTransmission(EEPROM_ADDRESS);
    Wire.write(byte(0x00));
    byte error = Wire.endTransmission();

    EEPROM_DATA response;
    Wire.requestFrom((int)EEPROM_ADDRESS, 29);
  
    int count = 0;
    while(Wire.available())
    {
      response.bytes[count] = Wire.read();
      count++;
    }

And the response:

I2C device found at address 0x50
Width FFFFFFFF
Height FFFFFFFF
Color 255
PCB 255
Display 255

OK, I’m with you now. Had to reread what was posted.
This is above my skill level, if I’m honest.

Wow, just wow! I did a little more research to better understand what read_i2c_block_data actually does. The second argument is the command byte, I’m guessing allowing you to maybe read data from other things from the same address. Anyways, it’s written to the bus before the read, so there is actually an extra 0x0 written to the I2C bus. I added one more byte of 0x0 to my initial write and the data is now correct. I’m able to read the EEPROM.

  Wire.beginTransmission(EEPROM_ADDRESS);
  byte data[] = { 0x00, 0x00 };
  Wire.write(data, 2);

Result:

I2C device found at address 0x50
Width 190
Height 12C
Color 2
PCB 12
Display 7

Nice, that’s good sleuthing. =)