Showing results for 
Search instead for 
Did you mean: 

Weird characters on I2C 16x2 LCD

Associate II

Greetings to all.

I'm Following some online courses to learn to program STM32. I have a very weird behavior of my board that gives me not few headaches. After reviewing, changing, testing my codes for 2 days i found a way to get my program running correctly, but i don't know why.

I was not able to make my i2c display work correctly. Allways weird characters as in Picture1. No way to make it run correctly.

So i finally decided to upload my first working project for learning displays and it worked correctly (Picture2)

Then i returned to upload again the program with weird chars and without modifying anything, and now it works! (Picture3)

If i disconnect (turn off) the usb of the nucleo, when i recconnect it, it "boots" as in Picture 4 and i have to redo all from start to make it works correctly.

So i thought it does not depend on code. but to something else.


Windows 7 (i will try with linux tomorrow)

TrueSTUDIO 9.3.0

CubeMX 6.1.0

Nucleo64 F401RE with still attached the STLink

USB 2.0 via a 10 port hub

Thank you



It is very clear that the first uploaded program does not initialize properly the LCD screen.

The second uploaded program initializes the LCD and when again upload the faulty program it works ok because the LCD is already initialized.

Search google for HD44780 initiialization and keep in mind that the initialization timings are crucial for proper functioning

Associate II

What appeared weird to me is that all the functions to initialize and use the i2c display are in an included external files. The same files for both projects.

However thank you for the advices and I will explore again the code and search for some differences i did not notice