SSD1306 skips every other line #1008
Replies: 18 comments
-
Posted at 2015-06-10 by @gfwilliams Hi Dennis, I think the problem might be how the display is initialised - if you look at the Adafruit Arduino code they use slightly different initialisation code depending on which display is used. It might be worth trying to make sure the initialisation is just like Adafruit's, and to then see if it works fine then - without having to mess with rows of pixels? If that works, I'm open to ideas about how to work it back into the module without breaking it for people that are currently using it - maybe a |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by Chris In case there are others who (like me) got stumped by this these settings worked for me by referencing the arduino code @gordon refers to above (thanks Gordon!)
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by @gfwilliams Thanks! So it's literally just line 4 and line 11? Maybe if the initialisation was modified to something like:
it could do it automatically? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by Chris Almost! You should also change the page max in flipCmds from 7 to 3 (but if you're just sending a 128x32 buffer then it still displays ok):
The only other issue I had with the module was a lack of support for a CS pin. Adding that would be nice. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by @gfwilliams Thanks! It started out as I2C, so CS was never an issue. Are you using it on a bus that's shared with something else then? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by Chris Yes, Adafruit's BMP183 sensor - the existing BMP085/BMP180 module is of course I2C. I have modified the existing module to use SPI but I haven't tested it and the display at the same time yet. At some point I will create a "BMP183" module for it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by @gfwilliams Ok, just made some changes but not published them yet. Please you try:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by Chris That doesn't work I'm afraid:
Line 5 should be the height-1 and line 12 is hardcoded to 0x12 (should be 0x02 for 32 lines) .
Line 6 should be 3 for 32 lines and 7 for 64.
This code does not take into account a height set in the options. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by @gfwilliams Isn't that what the 'update' function does? https://github.com/espruino/EspruinoDocs/blob/master/devices/SSD1306.js#L58 Good point about the Graphics height though. That'll need changing |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-18 by Chris ahh...yes... I thought I must have missed something crucial! :)
Line 3 should be:
...and won't that break backwards-compatibility? I think if no options are set you should create one and default in options.height = 64. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-19 by @gfwilliams I'm pretty sure it's But yes, you're totally right about the backwards compatibility - I was trying to save a few bytes by setting stuff to 0, and it didn't work :) edit: just updated and checked with the 128x64 displays and it works here for those, with or without the options. Could you check on your 128x32? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-19 by Chris Sorry, yes, you're right about initCmds[4]. I didn't work at the time. But I just plugged in the board this morning and it worked. So I don't know what was wrong before...probably user error ;) I don't know if I didn't save() before but I've reloaded the code (using the Github module) to the pico and it I can confirm it works! :) Thanks Gordon! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-19 by @gfwilliams Ok, great! Thanks for checking - I'll update the site with it this week. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-08-19 by Chris Happy to help! I think my issue before was that I was maybe trying to write to the display too soon. The display's datasheet (page 15) mentions a 100ms delay in the power-up sequence. The breakout board has only a VIN which I guess is attached to both VCC and VDD. So I can't attach VCC 100ms after VDD. With further testing I intermittently had the screen not turn on. While it looked like the connectSPI() completed (I switch off LED1/2 in the callback) nothing displayed. When it didn't work no commands I sent over SPI and operations on "g" seemed to get it to display. By doing a setTimeout() with a 100ms delay before initialising the display I seem to have got around the issue - I've tested it about 30 times and I haven't had a failure to get the display to work. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-08 by Dennis Great work, this also solved my problem. And I can report that it works also over I2C. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-09 by @gfwilliams Do you think that adding a 100ms delay into the module itself would help with this? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-09 by Dennis What solved the problem with my display was the changed init sequence. Mine works fine without the delay. In order to account for the slow power-up of other displays, the module could accept another parameter |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-11-19 by @fanoush Just to let you know that I have 128x32 display in DS-D6 fitness tracker that skips lines with current code
Even if it is 128x32 it works better with 0xDA, 0x12. Looks like it has RAM like 128x64. Not sure if it is normal for other 128x32 but it can hold two 128x32 images and I can flip between them by changing start offset. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-06-09 by Dennis
I have bought a couple of these I2C 128x32 OLED displays. They almost work with the SSD1306 module, however every other line is missing (i.e. pixels for y=0 are not displayed, pixels for y=1 appear in what is actually y=0, pixels for y=2 are not displayed, pixels for y=3 are displayed in what is actually y=1 and so on, pixels for y=63 appear in the last line which is actually y=31).
I had a look at the SSD1306 module which has the screen size hard-coded (maybe not the best idea) to 128x64. But if I change it to 128x32 (which would be correct), I get the exact same output, only a few lines further down. It seems that these particular displays need to be interfaced like 128x64 pixel displays but you need to transform the y coordinate of every pixel in the buffer to 2*y+1. What is the best way to patch the modules to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions