Feather RP2040 - OLED SH1107 Display Doesn't Show

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mechtech5473
 
Posts: 3
Joined: Tue Dec 18, 2018 5:48 pm

Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by mechtech5473 »

I've wired my OLED to my Feather and I see it when I use the I2C Scan example but when i use the sample code it doesn't work. Tried adjusting for the second port by switching &Wire to &Wire1 When creating the display object. I checked my power 3.3V power is good and checked board for 12v connection in case my ground had issues and it looks good. Checked resistance to pins from OLED to Micro Controller looks good. I don't know where i'm going wrong.

Code: Select all

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#include <Adafruit_NeoPixel.h>
#include <Adafruit_TestBed.h>
extern Adafruit_TestBed TB;

#define SECONDARY_I2C_PORT &Wire1

Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire1);

#define NeoPixel_Pin 16
#define NeoPixel_Count 1
Adafruit_NeoPixel strip(NeoPixel_Count, NeoPixel_Pin, NEO_GRB + NEO_KHZ800);

#define Button_A 9
#define Button_B 8
#define Button_C 7


void setup() {
  // put your setup code here, to run once:
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(100);

  strip.begin();
  strip.show();
  delay(50);
  strip.setPixelColor(0,100,100,100);
  delay(100);
  strip.setPixelColor(0,100,0,0);
  strip.show();
  
  Serial.begin(115200);
  //while (!Serial) delay(10);
  delay(250);
  
  strip.setPixelColor(0,100,20,0);
  strip.show();
  delay(500);
  Serial.println("System Starting");

  //Port Test
  Serial.print("Secondary Port (Wire1) ");
  TB.theWire = SECONDARY_I2C_PORT;
  TB.printI2CBusScan();
  strip.setPixelColor(0,100,40,0);
  strip.show();

  Serial.println("Start Display");
  display.begin(0x3C, true); // Address 0x3C default
  display.display();
  strip.setPixelColor(0,100,60,0);
  strip.show();
  delay(1000);
  display.clearDisplay();
  display.print("Started Display");
  display.display();
  delay(1000);

  Serial.println("Setup Buttons");
  strip.setPixelColor(0,100,80,0);
  strip.show();
  pinMode(Button_A, INPUT_PULLUP);
  pinMode(Button_B, INPUT_PULLUP);
  pinMode(Button_C, INPUT_PULLUP);

}

void loop() {
  // put your main code here, to run repeatedly:
  strip.setPixelColor(0,0,0,100);
  strip.show();
  if(!digitalRead(Button_A)) Serial.print("A");
  if(!digitalRead(Button_B)) Serial.print("B");
  if(!digitalRead(Button_C)) Serial.print("C");
  delay(500);
}
Attachments
20220718_152203[1].jpg
20220718_152203[1].jpg (144.65 KiB) Viewed 1612 times
20220718_152134[1].jpg
20220718_152134[1].jpg (105.04 KiB) Viewed 1612 times

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by adafruit_support_carter »

Try removing the residual testbed code. Run the example:
https://learn.adafruit.com/adafruit-128 ... de-3071194
and change only the one line to reference Wire1:

Code: Select all

Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire1);

User avatar
mechtech5473
 
Posts: 3
Joined: Tue Dec 18, 2018 5:48 pm

Re: Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by mechtech5473 »

Gave it try and same problem not displaying.

Code: Select all

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>

Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire1);

// OLED FeatherWing buttons map to different pins depending on board:
#if defined(ESP8266)
  #define BUTTON_A  0
  #define BUTTON_B 16
  #define BUTTON_C  2
#elif defined(ESP32) && !defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
  #define BUTTON_A 15
  #define BUTTON_B 32
  #define BUTTON_C 14
#elif defined(ARDUINO_STM32_FEATHER)
  #define BUTTON_A PA15
  #define BUTTON_B PC7
  #define BUTTON_C PC5
#elif defined(TEENSYDUINO)
  #define BUTTON_A  4
  #define BUTTON_B  3
  #define BUTTON_C  8
#elif defined(ARDUINO_NRF52832_FEATHER)
  #define BUTTON_A 31
  #define BUTTON_B 30
  #define BUTTON_C 27
#else // 32u4, M0, M4, nrf52840, esp32-s2 and 328p
  #define BUTTON_A  9
  #define BUTTON_B  6
  #define BUTTON_C  5
#endif

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

  Serial.println("128x64 OLED FeatherWing test");
  delay(250); // wait for the OLED to power up
  display.begin(0x3C, true); // Address 0x3C default

  Serial.println("OLED begun");

  // Show image buffer on the display hardware.
  // Since the buffer is intialized with an Adafruit splashscreen
  // internally, this will display the splashscreen.
  display.display();
  delay(1000);

  // Clear the buffer.
  display.clearDisplay();
  display.display();

  display.setRotation(1);
  Serial.println("Button test");

  pinMode(BUTTON_A, INPUT_PULLUP);
  pinMode(BUTTON_B, INPUT_PULLUP);
  pinMode(BUTTON_C, INPUT_PULLUP);

  // text display tests
  display.setTextSize(1);
  display.setTextColor(SH110X_WHITE);
  display.setCursor(0,0);
  display.print("Connecting to SSID\n'adafruit':");
  display.print("connected!");
  display.println("IP: 10.0.1.23");
  display.println("Sending val #0");
  display.display(); // actually display all of the above
}

void loop() {
  if(!digitalRead(BUTTON_A)) display.print("A");
  if(!digitalRead(BUTTON_B)) display.print("B");
  if(!digitalRead(BUTTON_C)) display.print("C");
  delay(10);
  yield();
  display.display();
}

User avatar
kb4mg
 
Posts: 12
Joined: Mon Apr 08, 2019 5:18 pm

Re: Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by kb4mg »

Did you ever figure this out? Mine works intermittently. I am using the Teesy3.1 platform and I2C interface. I have actually got it to work a few times, but if I unplug it and plug it in again, the display may not initialize. Very confused. I am toggling the RST pin using one of my GPIO pins, which I think is necessary.

User avatar
kb4mg
 
Posts: 12
Joined: Mon Apr 08, 2019 5:18 pm

Re: Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by kb4mg »

For whatever reason, the OLED does always get started by the display.begin() class method. I suspect it is a timing issue. These OLED displays were likely surplus from some Chinese products that may have had some different timing from the Arduino boards.
I did some experimenting and saw that if I reset the processor board about 5 times (sometimes more), the display starts working.

To initialize the display I did the following in my code:

for(int i =1; i<8; i++) {
display.begin(0x3C, true); // Address 0x3C default
delay(250);
}
display.display();
delay(2000);

See if this help with your case as well. I would love to know.

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by adafruit_support_carter »

@MechTech54 Try touching up the soldering. It's most likely a connection issue.

User avatar
mechtech5473
 
Posts: 3
Joined: Tue Dec 18, 2018 5:48 pm

Re: Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by mechtech5473 »

I got a new Board and it worked with no issues. The board was either damaged during storage (was 8 months before i used it) or bad soldering although.

User avatar
kb4mg
 
Posts: 12
Joined: Mon Apr 08, 2019 5:18 pm

Re: Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by kb4mg »

Thanks guys! I looked at the board carefully. Hard to tell if there are any issues. I am not using the headers, just the STEMMA QT connector for I2C and the Teensy 3.1 MCU board. Strange problem.

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: Feather RP2040 - OLED SH1107 Display Doesn't Show

Post by adafruit_support_carter »

@kb4mg Please start a new thread for your issue.

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

Return to “Other Arduino products from Adafruit”