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

SSD1322 on ESP32S SPI BUS (HSPI) #1364

Closed
LightningTerry opened this issue Dec 23, 2020 · 23 comments
Closed

SSD1322 on ESP32S SPI BUS (HSPI) #1364

LightningTerry opened this issue Dec 23, 2020 · 23 comments

Comments

@LightningTerry
Copy link

LightningTerry commented Dec 23, 2020

I use

And I am trying to connect these two together. But somehow nothing is displayed, neither I receive any Signals from the GPIO13(MOSI).

I tried using some Demo Codes Like this:
#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>

#define SPI_CS_PIN   10
#define SPI_MISO_PIN 11
#define SPI_SCK_PIN  12
#define SPI_MOSI_PIN 13
#define SPI_RES_PIN  33
#define SPI_DC_PIN   34

//U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* CS=*/ SPI_CS_PIN, /* reset=*/ SPI_RES_PIN);
U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI u8g2(U8G2_R0, /*SCK=*/SPI_SCK_PIN , /*MOSI=*/SPI_MOSI_PIN, /*CS=*/SPI_CS_PIN, /*DC=*/SPI_DC_PIN , SPI_RES_PIN);

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
  u8g2.drawStr(10,20,"Hello World!");  // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
  delay(500);
}

But It does not work.

I even tried things, suggested in here #1331

@v1993
Copy link

v1993 commented Dec 23, 2020

Please put your code inside ```. Includes are so broken by parsing them as html tags.

@olikraus
Copy link
Owner

Did you try the sw constructor? At least to check whether the wiring is ok.

@LightningTerry
Copy link
Author

@olikraus do you mean using this instead?

#define SPI_MOSI_PIN 13
#define SPI_MISO_PIN 12
#define SPI_SCK_PIN  14
#define SPI_CS_PIN   15
#define SPI_DC_PIN   10

//U8G2_ST75256_JLX25664_F_4W_HW_SPI u8g2(U8G2_R0, /* CS=*/ SPI_CS_PIN, /* reset=*/ U8X8_PIN_NONE);
U8G2_ST75256_JLX25664_F_4W_SW_SPI u8g2(U8G2_R0, /*SCK=*/SPI_SCK_PIN , /*MOSI=*/SPI_MOSI_PIN, /*CS=*/SPI_CS_PIN, /*DC=*/SPI_DC_PIN , U8X8_PIN_NONE);

Should there be any difference? It still does not show any error message.

@olikraus
Copy link
Owner

I also strongly suggest to connect the reset pin.

@LightningTerry
Copy link
Author

So as i was connecting the reset pin, i noticed that my pinout I was using, did not match with the description in the datasheet, so i changed some other pins aswell (I updated the Code in the Issue Description). But even with that it still doesn't show anything on the Display.

@olikraus
Copy link
Owner

In your initial post you have referenced a display with SSD1322 controller. Your constructor is for a display of the same size but with a ST75256 controller. Obviously this will not work.

If you own the display described in the reference under JLX25664, then you should use one of the following constructors:
https://github.com/olikraus/u8g2/wiki/u8g2setupcpp#ssd1322-nhd_256x64

Also note, that you need to enable U8g2 16 bit mode (unless you use the latest u8g2 release, which will enable 16 bit mode automatically for your board)

@LightningTerry
Copy link
Author

Thank you, with this change I finally could Display something for the first time :)
But somehow i had a white square on the top right corner of the Display. And after I did a reset i couldn't display anything anymore, with the same Code.

@LightningTerry LightningTerry changed the title JLX25664 on ESP32S SPI BUS (HSPI) SSD1322 on ESP32S SPI BUS (HSPI) Dec 29, 2020
@LightningTerry
Copy link
Author

I am not sure if this also helps, but i just noticed, that the code I use, the "Hello World!" should be displayed 10 pixels far from the left border. But that one time that it displayed the text was directly at the coordinates 0,0.
image0 (2)

@olikraus
Copy link
Owner

I think the box is caused by 8 bit mode. Did you change to 16 bit mode (see FAQ)?

@LightningTerry
Copy link
Author

yes, I uncommented the Line #define U8G2_16BIT

@olikraus
Copy link
Owner

yes, I uncommented the Line #define U8G2_16BIT

so everything works now?

@LightningTerry
Copy link
Author

Sorry, i meant that i already had the line uncommented. But i can't even check anymore if it works, because somehow since i pressed the reset button it doesn't show anything at all on the display.

@olikraus
Copy link
Owner

oh

@LightningTerry
Copy link
Author

Update: If I change the delay to 500ms, I have almost everytime something on the Display, sometimes it doen't work, but i guess it's a hardware problem. Besides this, it also doesn't show anything if I use the drawStr on the wrong Coordinates or use Values between 10..15...20.. and so on. And the Display somehow doesn't use its full size, it cuts the bottom of the text already at a pointer(10,20).

Unbenannt

@olikraus
Copy link
Owner

Besides this, it also doesn't show anything if I use the drawStr on the wrong Coordinates or use Values between 10..15...20.. and so on.

You have not sent any code, so it is difficult to say what is wrong here, but from the picture I would say, you have used the "1" constructor but instead you should use the "F" constructor.

@LightningTerry
Copy link
Author

Is "U8G2_ST75256_JLX25664_F_4W_SW_SPI" not the "F" constructor?
If it's not, what would it be, or what should I change?

@olikraus
Copy link
Owner

hmm, so the code in your initial post will exactly show the above picture?
I have a request: Can you execute the u8x8 hello world? How will it look like?
You probably need to uncomment this line and add replace your personal pinnumbers:

//U8X8_SSD1322_NHD_256X64_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);

By default the "hello world" will be printed in the second line:

u8x8.drawString(0,1,"Hello World!");

Will it appear?
What will happen if you change the y position? Will hello world always appear in the correct line?

@LightningTerry
Copy link
Author

Okay, if I Use it on Position 0,1 then it looks like this:
image0 5
But with this Code i can move the text up to position 20,6
image1
I thought, that the white Box appears, because it isn't able to display the "!". After removing it and just displaying "Hello World" the box disappears, but instead the "H" in the beginning behaves weird.
IMG_0825

@olikraus
Copy link
Owner

Very strange, I never saw such a behavior before.
Let's try to see, whether there is a timing issue:

u8g2/csrc/u8x8_d_ssd1322.c

Lines 247 to 248 in 3c6460a

/* post_chip_enable_wait_ns = */ 20,
/* pre_chip_disable_wait_ns = */ 10,

Please locate u8x8_d_ssd1322.c on you local harddisk (should be in the arduino library folder) and double/increase the above mentioned values. Especially the post cs delay might have cause the problems.
Will this help?

@LightningTerry
Copy link
Author

Changing the values also changes the pattern of the animated pixels so it really might be something with the Chip Select. But even after playing around with the values I couldn't get rid of the error.
And its not always the "H", sometimes, it's also the "d" at the end, it switches randomly when I reset. Maybe that helps.

@olikraus
Copy link
Owner

Can you choose a different pin for the CS signal? Maybe also change wiring for the CS signal completely.

@LightningTerry
Copy link
Author

I tried that, but sadly didn't change anything.

@olikraus
Copy link
Owner

olikraus commented May 9, 2021

oh, long time pending topic here.
Did you solve the problem?

@olikraus olikraus closed this as completed Mar 4, 2022
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

3 participants