Showing results for 
Search instead for 
Did you mean: 

STM32F4 I2C SSD1306 - OLED Display Initialization / Reinitialization Issue

Associate II

Hi everybody, i am using stm32f4 i2c. First, I execute the program successfully, then I execute it again and the Oled screen appears like this.

What is this error?
Can you help me fix it?



Andrew Neil
Evangelist III

What do you mean by, "execute it again" ?

  • Reset the processor ?
  • Power-cycle the system ?
  • other ??

Do you have an oscilloscope and/or logic analyser to see what's happening on the wires?


@noname8888 wrote:

 i am using stm32f4 

Please give the full part number.

Also, is this on an ST board, some 3rd-party board, or your own custom board?

  • For ST or 3rd-party, please give full details
  • For custom, please give schematic

I downloaded the program successfully, then I unplugged it, plugged it back in, and then reloaded it but it didn't work

@noname8888 wrote:

I downloaded the program successfully

You didn't answer the questions of what you're downloading onto! ie, what chip & what board?

What did you use to do the download?


@noname8888 wrote:

then I unplugged it

Unplugged what? From what?


@noname8888 wrote:

plugged it back in, 

Again what did you plug back in - and to where?


@noname8888 wrote:

and then reloaded it but it didn't work

So at what point(s) in the above sequence was it working ?


>>What is this error?

What colour is your car?

Looks to be an error in your initialization, or the memory you copied into the device's frame buffer from your own STM32 side one. You should clear the STM32 side buffer, with all-zero's, and then ensure it's moved into the device side buffer.

What's the Black bar? Where you wrote some black-on-black text string?

Is it an authentic SSD1306 or an SH1106 ?

These are very similar one has a 128 pixel width the other a 132 pixel width, at least in the controller, the display often has only 128 pixels, and there's a 4-pixel wide band of junk if the buffer's not managed properly.

There's not an ASYNC reset, the SSD1309's have that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

tôi đã tham khảo một số nguồn, họ bảo sử dụng sh1106 driver, right?

"I consulted some sources, they said to use sh1106 driver, right?"

The driver I'm using can determine SSD1306 vs SH1106 by register read-back check.

The output you show is not indicative of being the wrong driver, but that the memory inside the IC for the frame buffer isn't cleared properly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..