Skip to main content
Qsdxkh
Associate II
January 27, 2023
Solved

Im using stm32 bluepill im trying to use OLED 128x32 i have tried libraries but nothing is working,same OLED worked with Adruino Mega. If anyone knows what might be the issue please let me know[SOLVED]

  • January 27, 2023
  • 7 replies
  • 5321 views

..

This topic has been closed for replies.
Best answer by Mshar.2

Hello, I had the same problem. While debugging i found that device was not getting initialized because I2C status flag was stuck on "BUSY" and i couldn't found why.

Temporary solution is to use STM32 Cube IDE instead of Cube MX. Everything worked fine for me in CubeIDE.

Also, if i copy-paste i2c.c and i2c.h file from Cube IDE folder to Cube MX folder, then Cube MX also works properly

7 replies

KnarfB
Super User
January 27, 2023

You probably have an error.

hth

KnarfB

Qsdxkh
QsdxkhAuthor
Associate II
January 27, 2023

I've tried many many libraries but no luck. The screen remains blank. No response.

But the same screen works with arduino. So i know connections are fine, only problem with coding.

Here are the libraries that I've tried

  1. https://github.com/vookimedlo/stm32-ssd1306
  2. https://github.com/GolinskiyKonstantin/STM32_Lib_OLED_SSD1306_I2C_SPI
  3. https://www.youtube.com/watch?v=ruDyTsmVls4
  4. https://www.youtube.com/watch?v=Mt6U30Yxrr8

I've also tried changing the address from 0x78 to 0x77 and 0x3C but no luck.

I do not get error in any of them but the screen remains blank.

Tesla DeLorean
Guru
January 27, 2023

>>I've also tried changing the address from 0x78 to 0x77 and 0x3C but no luck.

What address is working on the Arduino?

Typically the ST side wants (addr << 1), where as Arduino wants (addr)

Does the STM32 HAL side I2C code indicate the address was acknowledged, or not?

Any error status reported via the HAL commands?

Show a wiring diagram of the pins you're using, and what connects to what.

Make sure you're properly initializing the pins.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Mike_ST
ST Technical Moderator
January 27, 2023

Hello,

Do you have pull-up resistors on the I²C lines ?

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
Qsdxkh
QsdxkhAuthor
Associate II
January 27, 2023

No i have connected them directly, i will try using pull up resistor and let you know

Qsdxkh
QsdxkhAuthor
Associate II
January 27, 2023

Hello @Mike_ST​  i tried with pull-up resistors 4.7k but still no response from oled display.

It works fine in all the videos on youtube even without pull-up resistor.

Can you suggest any other trouble shoot?

Mike_ST
ST Technical Moderator
January 27, 2023

>It works fine in all the videos on youtube even without pull-up resistor.

In theory, I²C lines needs pull-up resistors, whatever the videos are showing.

They might have used internal pull-up resistors, but in some cases this is not enough.

> Can you suggest any other trouble shoot?

Check the I²C signal with a scope, and check that it is running at 100KHz.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
Mshar.2
Mshar.2Best answer
Associate II
January 28, 2023

Hello, I had the same problem. While debugging i found that device was not getting initialized because I2C status flag was stuck on "BUSY" and i couldn't found why.

Temporary solution is to use STM32 Cube IDE instead of Cube MX. Everything worked fine for me in CubeIDE.

Also, if i copy-paste i2c.c and i2c.h file from Cube IDE folder to Cube MX folder, then Cube MX also works properly