2023-01-27 04:34 AM
2023-01-28 05:49 AM
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
2023-01-27 04:54 AM
You probably have an error.
hth
KnarfB
2023-01-27 06:14 AM
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
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.
2023-01-27 06:29 AM
Hello,
Do you have pull-up resistors on the I²C lines ?
2023-01-27 06:31 AM
No i have connected them directly, i will try using pull up resistor and let you know
2023-01-27 07:50 AM
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?
2023-01-27 08:21 AM
>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.
2023-01-27 08:26 AM
>>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.
2023-01-28 05:49 AM
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