Electronic – OLED 128 x 32 SSD1306 display problem (picture inside)

avrlcdoled

I bought one of these cheap 0.91" OLED displays and hooked it up according to a datasheet that was sent to me by the seller. I tried several drivers for it after I thought there are compatibility problems, but all of them give the same problem. Only the top of the display shows any characters, the rest seems like random pixels and it flickers while lines are running up and down on it. VBAT + VDD are connected to ~3.3V.

Perhaps someone can spot the issue just by looking at the display picture?

Wiring, the 1uF caps are ceramics, the 4.7uF electro
Here is the initiation sequence:

void oled_init() {
    L(PORTE, SS1306_OLED_RST);
    _delay_ms(10);
    H(PORTE, SS1306_OLED_RST);
    _delay_ms(10);

    oled_write(0, 0xAE); // display off
    oled_write(0, 0xD5); // clock
    oled_write(0, 0x81); // upper nibble is rate, lower nibble is divisor
    oled_write(0, 0xA8); // mux ratio
    oled_write(0, 0x3F); // rtfm
    oled_write(0, 0xD3); // display offset
    oled_write(0, 0x00); // rtfm
    oled_write(0, 0x00);
    oled_write(0, 0x8D); // charge pump
    oled_write(0, 0x14); // enable
    oled_write(0, 0x20); // memory addr mode
    oled_write(0, 0x00); // horizontal
    oled_write(0, 0xA1); // segment remap
    oled_write(0, 0xA5); // display on
    oled_write(0, 0xC8); // com scan direction
    oled_write(0, 0xDA); // com hardware cfg
    oled_write(0, 0x12); // alt com cfg
    oled_write(0, 0x81); // contrast aka current
    oled_write(0, 0x7F); // 128 is midpoint
    oled_write(0, 0xD9); // precharge
    oled_write(0, 0x11); // rtfm
    oled_write(0, 0xDB); // vcomh deselect level
    oled_write(0, 0x20); // rtfm
    oled_write(0, 0xA6); // non-inverted
    oled_write(0, 0xA4); // display scan on
    oled_write(0, 0xAF); // drivers on
}

And what the LCD shows after I sent some characters to it.
enter image description here

Best Answer

Taking a guess in lieu of more information (see my comments above). It does look suspiciously like what is drawn is 1/8th of the screen. The controller says that it operates at 8 bits per pixel (256 monochrome levels). Are you drawing into the screen as if it was a 1 bit per pixel screen instead of 8? As I noted in the comment above, you will not be able to hold a frame buffer at 8 bpp and still have any RAM left to do anything else.

Related Topic