OLED 128x64 works with LC but not with 3.6

Status
Not open for further replies.
I'm working on a project that uses one of these SSD1309 I2C OLED displays: https://www.ebay.com/itm/I2C-2-42-128x64-Graphic-OLED-Yellow-Display-SSD1309-Arduino-PIC-Multi-wii/201468080188?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

I hooked it up to a Teensy LC for testing and it works as expected.
My final project uses a Teensy 3.6. Running this exact same code on the 3.6 it reports no errors, but the display does not light up. A voltmeter reports the same voltage at the display in both cases: 3.27V

Any idea why this works on the LC but not the 3.6?


Code:
#include <U8g2lib.h>
#include <Wire.h>

U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,19,18, U8X8_PIN_NONE);

void setup() 
  {
  Serial.begin(9600);

  Serial.println("Starting.");
  
  // init the OLED display
  if (!u8g2.begin()) Serial.println("Failed to connect.");
  else Serial.println("Begin succeeded");
  }

uint8_t m = 24;

void loop() 
  {
  int j,k;
  char m_str[3];
  strcpy(m_str, u8x8_u8toa(m, 2));    /* convert m to a string with two digits */

  u8g2.setFont(u8g2_font_finderskeepers_tf);

  u8g2.clearBuffer();
  u8g2.drawStr(0,10,"Hello World!");
  u8g2.drawStr(0,63,"9");
  u8g2.drawStr(9,63,":");
  u8g2.drawStr(12,63,m_str);

  for (j = 0; j < 128; j++)
    {
    u8g2.drawPixel(j, 24 + j%32);
    }
      
  u8g2.sendBuffer();
  
  delay(1000);
  m++;
  if ( m == 60 )
    m = 0;

  }
 
Might help to see the wiring? I am assuming you are using standard I2C wiring. Not sure if the display has built in Pull UP resistors and/or you are using external ones?
 
I have the Teensy 3.6 socketed in to my board. I pulled it out and retested on a breadboard with the simplest circuit possible. It works as expected, so my error is in my wiring somewhere. Sorry for the false alarm.
 
I have the Teensy 3.6 socketed in to my board. I pulled it out and retested on a breadboard with the simplest circuit possible. It works as expected, so my error is in my wiring somewhere. Sorry for the false alarm.

Posting an update in case this helps someone else running into the same problem.

Further investigation leads me to think this is a bug in the U8g2lib library. When compiling for the Teensy 3.6, the U8g2lib does not work correctly if there are any other I2C devices on the same bus. For whatever reason this works correctly on the Teensy LC, but not on the Teensy 3.6. It's definitely not an address conflict, each device has its own unique address.

Simpler cases where the OLED display is the only device on the I2C bus will work on the 3.6. Adding a second device (in this case a Sparkfun SX1509 IO Expander) to the bus causes the code generated for the 3.6 to not work correctly.

Switching to the Adafruit_GFX and Adafruit_SSD1306 libraries to drive the OLED has resolved my problems and now the display is working happily on the 3.6 with the other I2C devices.
 
Status
Not open for further replies.
Back
Top