SSD1327 display initialization error (128x128 OLED)

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
arek21
 
Posts: 17
Joined: Tue Oct 06, 2020 12:24 am

SSD1327 display initialization error (128x128 OLED)

Post by arek21 »

I'm getting an initialization error with this display
https://www.adafruit.com/product/4741
I'm using ESP32 Feather V2. Sample for Arduino does not work - "Unable to initialize OLED"
Address is correct and ESP32 surely has enough memory

I thought it is broken but purchased second one and it behaves exactly the same.

I started messing with I2C scan.

Now there is a strange part.
When I added Wire1 to I2C scan and execute it before calling OLED begin then it works.
Even though Wire1 scan displays errors.
Any idea what is going on and hot wo properly initialize it without this scan?

Scan:

Code: Select all

extern Adafruit_TestBed TB;

#define DEFAULT_I2C_PORT &Wire
#define SECONDARY_I2C_PORT &Wire1

void ScanI2C() {
  Serial.print("Default port (Wire) ");
  TB.theWire = DEFAULT_I2C_PORT;
  TB.printI2CBusScan();

#if defined(SECONDARY_I2C_PORT)
  Serial.print("Secondary port (Wire1) ");
  TB.theWire = SECONDARY_I2C_PORT;
  TB.printI2CBusScan();
#endif
}

Code: Select all

Default port (Wire) I2C scan: 0x0, 0x18, 0x70,
Secondary port (Wire1) [   265][E][Wire.cpp:77] initPins(): no Default SDA Pin for Second Peripheral
I2C scan: [   265][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[   269][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[   275][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[   281][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[   287][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
...
Display initialized

User avatar
rooppoorali
 
Posts: 98
Joined: Sat Jul 16, 2022 12:04 pm

Re: SSD1327 display initialization error (128x128 OLED)

Post by rooppoorali »

Looks like other users faced this problem too earlier: viewtopic.php?f=19&p=888448

User avatar
arek21
 
Posts: 17
Joined: Tue Oct 06, 2020 12:24 am

Re: SSD1327 display initialization error (128x128 OLED)

Post by arek21 »

Yes, I saw it and also other but it seems none of them have solution.

As I wrote I can make it work with this strange scan of I2C.
Someone with initialization problem stated that Python example worked while Arduino not.

So, everything is ok just seems like something that supposed to be done is not during initialization in Arduino library. Question is what?

User avatar
michaelmeissner
 
Posts: 1821
Joined: Wed Aug 29, 2012 12:40 am

Re: SSD1327 display initialization error (128x128 OLED)

Post by michaelmeissner »

Note, I haven't used the ESP32 V2, but I didn't see where you enabled the I2C bus. Quoting from the pinout sheet:

User avatar
arek21
 
Posts: 17
Joined: Tue Oct 06, 2020 12:24 am

Re: SSD1327 display initialization error (128x128 OLED)

Post by arek21 »

Found a problem.
It is related to internal power on ESP32 (this NEOPIXEL_I2C_POWER pin)

I had it set to high (on) but I guess it need time to stabilize or something.
After adding delay(200) between turning on power on that pin and display initialization it works.
delay(100) was too short.

Code: Select all

void ESP32Tools::EnableInternalPower() {
  pinMode(NEOPIXEL_I2C_POWER, OUTPUT);
  digitalWrite(NEOPIXEL_I2C_POWER, HIGH);
  delay(200);
}

void Display::Init() {
    m_initialized = m_display.begin(0x3D);
    if (m_initialized) {
        m_display.clearDisplay();
        m_display.display();
        Serial.println("Display initialized");
    }
    else {
        Serial.println("Cannot initialize display");
    }
}

void setup() {
  Serial.begin(115200);
  while (!Serial) { delay(5); };

  ESP32Tools::EnableInternalPower();
  Display::Init();
  ...
}
  

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”