Can't display a test message on SSD1322 with ESP8266

Hello,

I'm a newbie and I'm trying to learn how to use an ESP controlled display.
I had tried with an ESP32 but as I kept crashing, I went back to testing with an ESP8266.

Here's my code with all the connections included:

#include <U8g2lib.h>
#include <SPI.h>

// Pin definitions
#define SCLK_PIN  D5  // GPIO14 - DISPLAY PIN4
#define SDIN_PIN  D7  // GPIO13 - DISPLAY PIN5
#define CS_PIN    D3  // GPIO0 - DISPLAY PIN16
#define DC_PIN    D2  // GPIO4 - DISPLAY PIN14
#define RESET_PIN D1  // GPIO5 - DISPLAY PIN15

// Initialize the U8g2 object for the SSD1322 display in software SPI mode
U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI u8g2(U8G2_R0, SCLK_PIN, SDIN_PIN, CS_PIN, DC_PIN, RESET_PIN);

void setup() {
  Serial.begin(115200);
  Serial.println("Initializing the OLED display...");

  // Check for the presence of the display by sending a command and verifying the response
  if (u8g2.begin()) {
    Serial.println("OLED display detected and initialized.");
    u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_ncenB08_tr);  // Select the font
    u8g2.drawStr(0, 24, "Hello, World!");
    u8g2.sendBuffer();
    Serial.println("Message displayed on the screen.");
  } else {
    Serial.println("Failed to detect the OLED display. Check the connections.");
  }
}

void loop() {
  // Empty loop
}

However, the display doesn't light up even though it's powered by a 3.7V battery. I can't figure out where my problem lies.
At first I thought it was the screen, I tried to change it with a new one but the problem continues.

However, the code executes well, as I receive my messages on the serial monitor.

Could you please suggest a solution?

Thank you in advance

First prove you have the screen that the software is wanting to work with. You have specified a very long string

U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI

Now show us the markings on the physical screen that match that.
I assume the sketch is copied from the library samples.

Hello Sonofcy,

Thank you for your feedback.

As you can see, I think it's the good configuration. Isn't it ?

The sketch is copied from samples yes :slight_smile:

Sorry, I see nothing remotely like 1322 on there, Why do you think that is a SSD1322?

The model I'm sure of is the SSD1322 because that's what I bought.

What board are you using it with?

Just for giggles, why not try the sample Hello World to see if that makes a difference.

Your display appears to be configured for 80XX parallel interface, not 4W SPI.

Look at the resistors in the area I circled in red. There are resistors in locations R8 and R6:

Looking at the table at the bottom-right of the image, you can see that this configuration corresponds to 80XX Parallel interface.

If you want 4W SPI interface, you will need to move the resistor from R6 to R5.

2 Likes

I'm using an NodeMCU (ESP8266)

Oh yes, you're right... Thank you
I can't move the resistors, I'm not equipped for that. I don't have a microscope and my soldering iron isn't going to help me much on sight. I can try, but I risk screwing it up.
So if I understand correctly, to make it work, not only do I have to adapt my code but I also have to adapt my connection to use the 8 data pins as well as the 3 control pins... But since my ESP8266 is limited... So in fact I'm more likely to recommend a new screen that allows 4-wire SPI.
Do we agree?

Not without difficulty I just moved the resistance. A painstaking job like I've never done before.

I checked with the multimeter and there's continuity between the 2 edges, so we should be good.
I'm going to reassemble my wiring and I'll let you know if I see any change.

After hours and hours and hours
it finally works
Thank you so much for all your help, I've learned a lot.

1 Like

Well done on that soldering.

If you had lost or damaged that resistor, you could simply put a large blob of solder across the pads. The 'resistors' are 0 ohms!

If you had not attempted to move the resistor, you could have complained to the seller, because it was described as SPI, but the board that was sent to you was not configured that way.

I must ask: why is your ESP8266 not plugged into your breadboard? That is the normal way.

Also your code is configured to use software SPI. If you can use the ESP8266's hardware SPI pins, the performance/update speed will be much better.

2 Likes

Hello Paul,

Thanks for your advice
To tell the truth, I've lost the resistance of the first screen so I'll try to connect the 2 dots like you told me. This will save me from throwing it away for nothing.

As for the hardware pins, I don't know which ones they are.
I'll find out :slight_smile:


You should use the "HSPI" pins on the right side in this image (D5-D8).

1 Like

I have to change the pin to the right ones and that's it ?
Or the code must be changed ?

Because I don't see any set up of software SPI declared.

Both

The "SW_SPI" says it's software SPI. There will be an equivalent "HW_SPI" constructor which will take fewer parameters because the hardware SPI pins are fixed so don't need to be specified.

1 Like

Thank you for these information
I'll look at the documentation of the library then :smiley: