cancel
Showing results for 
Search instead for 
Did you mean: 

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]

Qsdxkh
Associate II
 
1 ACCEPTED SOLUTION

Accepted Solutions
Mshar.2
Associate II

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

View solution in original post

8 REPLIES 8
KnarfB
Principal III

You probably have an error.

hth

KnarfB

Qsdxkh
Associate II

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.

Mike_ST
ST Employee

Hello,

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

Qsdxkh
Associate II

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

Qsdxkh
Associate II

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 Employee

>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.

>>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
Up vote any posts that you find helpful, it shows what's working..
Mshar.2
Associate II

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