-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
u8g2 not working properly on Teensy 4.0 #1104
Comments
Any documents regarding the OLED? Links? Datasheet? |
One more question: Which u8g2 constructor did you use? |
One of the following (I tried all 6 of them) basically what I could find for 1306 and 1309 oleds (HW SPI): U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI(rotation, cs, dc [, reset]) [page buffer, size = 128 bytes] U8G2_SSD1309_128X64_NONAME0_1_4W_HW_SPI(rotation, cs, dc [, reset]) [page buffer, size = 128 bytes] I noticed that the problem appears when the Initialize() function (called in begin() ) is called. Even if I stripped the code to just the initialize() and the power save() functions for the oled, the lines appeared. Probably worth mentioning that I used the Arduino version of the u8g2 Library with the latest version of the Arduino IDE and Teensydoino. |
How many pixel are between each lines? Is the line every 8th pixel? |
Yes. The line is every 8th pixel. There are 7 pixels between the lines. |
Hmm... your last link to the datasheet claims that this is a SSD1306 display. |
Just a little update. After some more trial and error it seems that the library works "fine" (everything works except the horizontal lines appear on the oled) only with the SSD1306 constructor. Any of the SSD1309 constructors make the screen usable only on the bottom 7 pixels - the pixels under the bottom horizontal line. Everything else on the screen remains the same as the first code uploaded - If I modify something in the code and reupload, the top side remains as the first upload of the sketch, and only the bottom side changes - see attached image. |
Did you also try the "U8G2_SSD1309_128X64_NONAME2" constructor? I still think the display is somehow damaged and the horizontal lines is a broken RAM. |
I will try again the constructor you mentioned and I will let you know if something changes. I don't think the display is damaged because it works fine with the SparkFun HyperDisplay library. (Exactly the same configuration) No lines appear on the display. Just that the Sparkfun library is very slow and I would like to use your library because is much simpler and faster. I also tried your library with another identical oled and Teensy 4.0 and the same horizontal lines appear. Both oleds work fine with the Arduino Nano and the Adafruit 1306 library. The Teensy is somehow not working well with the u8g2 library. |
I understand. The only other thing, what I could imagine is a SPI byte transfer problem. Will the display work correctly with Arduino Nano and u8g2? If so, then indeed there might be an issue with the SPI.h lib implementation for Teensy. Maybe also there is a timing issue. Things to test:
SPI Modes are 0 to 3 and can be modified by changing the u8g2 code: There might be other issues coming from SPI.h. For example the CS handling might be critical: There must be a certain delay after the last bit transfer. But this depends on the SPI.h implementation, I can't anything from u8g2 lib perspective. |
I tried the constructor. Here is the result:
I will test the options you said this afternoon. |
So it works except for a 32 pixel shift, correct? To fix the 32 pixel shift, try to change the start line: |
|
I changed the bus speed but the oled still displays the horizontal line. |
It depends on the constructor. I mean, the line in the code might be different depending on the constructor you use.
What about the software SPI constructors? |
I just tried to use SW SPI and the display works with the SSD 1306 constructor. With the SSD 1309 constructor the display is shifted. See video attached. However, I would really like to use HW SPI. Could a fix be implemented? Or what could I do in order to make the oled work in HW SPI? |
Ok, so if I understand correctly, there are two problems which are independent:
I might solve the second point, but the first point seems to be a problem with your Teensy board. |
I understand. So my Teensy board is deffective? Or the SPI.h file needs to be rewritten somehow for the Teensy? |
I am sure the Teensy board is fine, but I assume, the low level software has an issue. The other problem could be this: Maybe the Teensy 4.0 is simply too fast. |
Thank you very much for all the information. And I really appreciate that you took the time to try to solve the issue. |
I tried changing the Bus speed again using the u8g2.setBusClock() but it seems to have no effect on the oled. The speed of the drawings does not change. I use the U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI constructor. I placed the function call right after the u8g2.begin(). I tried even u8g2.setBusClock(1000) and no effect. Am I doing something wrong here? Also, I tried changing the delays in the file you specified. That had no effect on the horizontal lines. I think I will try to open an issue on the SPI library developed by PaulStoffregen. Maybe he knows what is going on. Could you tell me if there is a way to make the SW SPI work faster? I saw there was an issue here and a user comments out some delays n the files, but those delays are already commented out in the library I have. Thanks. |
There are ways to make sw spi faster, but this is no portable code and depends on the target controller/board. |
I changed the code as you mentioned and IT WORKS! I changed the spi_mode = 3 here: I am sorry that is was such a simple solution and I did not know how to implement it. Thank you very very much for the information. |
Well... Yes, but it means, that there's an issue with the spi implementation. |
I understand. Well, it seems that the guys that produced the Teensy bought some of these displays and will work on a fix. |
I am sorry if this is not the right palce to post this.
When using the u8g2 library with a SSD 1309 2.42 inch display and a Teensy 4.0, as soon as the begin() function gets called, horizontal lines appear on the display and do not disappear no matter what I do.
The clearDisplay() function clears all other objects from the screen, but the horizontal lines remain. Everything else works just fine with the library.
Is there a way to make the oled behave normally?
I attached a image. (The orientation of the text is not a problem.)
The text was updated successfully, but these errors were encountered: