olikraus / u8g2

U8glib library for monochrome displays, version 2
Other
4.91k stars 1.02k forks source link

SSD1309 SPI connection is causing erratic display #2411

Open Gopijackson opened 3 months ago

Gopijackson commented 3 months ago

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

include

include

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 commented 3 months ago

You need to use "U8G2_SSD1309_128X64_NONAME2_F_4W_SW_SPI "

Gopijackson commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

No change,Same like first display pic 1711985544898

olikraus commented 3 months ago

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 commented 3 months ago

Yeah,I tested with F constructor

Gopijackson commented 3 months ago

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 commented 3 months ago

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

Gopijackson commented 3 months ago

plz help, how to solve this issue !

olikraus commented 2 months ago

Not sure how I can do this from my end.