Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSD1309 SPI connection is causing erratic display #2411

Open
Gopijackson opened this issue Mar 28, 2024 · 10 comments
Open

SSD1309 SPI connection is causing erratic display #2411

Gopijackson opened this issue Mar 28, 2024 · 10 comments

Comments

@Gopijackson
Copy link

Gopijackson commented Mar 28, 2024

I've successfully flashed my code for the SSD1309 display, but it's showing irregularities in its output, as depicted in the provided image.

I'm using ESP32-S3-MINI-1

Display_image

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

#define OLED_SCL 13 // Define the SCL pin
#define MOSI_PIN 11 // Define the MOSI pin
#define OLED_CS 10 // Define the CS pin
#define OLED_DC 9 // Define the DC pin
#define OLED_RESET 8 // Define the RESET pin
U8G2_SSD1309_128X64_NONAME2_1_4W_SW_SPI u8g2(U8G2_R0,OLED_SCL, MOSI_PIN,/* cs=/ OLED_CS, / dc=/ OLED_DC, / reset=*/ OLED_RESET);

void setup() {
u8g2.begin();
u8g2.setFont(u8g2_font_logisoso28_tf); // Set font size to a suitable size
u8g2.clearBuffer();
}
void loop() {
u8g2.drawStr(5, 28, "Hi");
u8g2.sendBuffer();
delay(3000);
u8g2.clearBuffer();
u8g2.sendBuffer();
delay(1000);
}

How can I fix it?
Thanks.

@olikraus
Copy link
Owner

You need to use "U8G2_SSD1309_128X64_NONAME2_F_4W_SW_SPI "

@Gopijackson
Copy link
Author

Gopijackson commented Apr 1, 2024

U8G2_SSD1309_128X64_NONAME2_F_4W_SW_SPI

i tried that also, but still that erratic display.
plz, check that below image for that display back side that is crt right?
SSD1309_Back_view

plz, help to solve the issue

@olikraus
Copy link
Owner

olikraus commented Apr 1, 2024

plz, help to solve the issue

not sure how I can do this.

What is the display output if you just repace the constructor with the initially provided code?

@Gopijackson
Copy link
Author

Gopijackson commented Apr 1, 2024

No change,Same like first display pic
1711985544898

@olikraus
Copy link
Owner

olikraus commented Apr 1, 2024

In your code you have used sendBuffer() to update the display. However, sendBuffer() requires the "F" constructor. In your code you have instead used the "1" constructor, which is wrong and typically it leads to a blank 8-pixel height row on the display. Such a blank 8-pixel height row seems to be there in the lower part of your both of your pictures. Are you really sure you have tested your code with the "F" constructor?

@Gopijackson
Copy link
Author

Gopijackson commented Apr 1, 2024

Yeah,I tested with F constructor

@Gopijackson
Copy link
Author

Gopijackson commented Apr 1, 2024

i tried HW_SPI and SW_SPI with the ESP32 dev module, ESP32-S2, ESP32-S3, ESP8266, and Arduino Uno also tried but,same issue.
But there were minor differences in the display when switching modules.

img_20240401_120108905_ae

@olikraus
Copy link
Owner

olikraus commented Apr 1, 2024

hmm maybe there is something wrong with the DC line...

@Gopijackson
Copy link
Author

plz help, how to solve this issue !

@olikraus
Copy link
Owner

Not sure how I can do this from my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants