Skip to main content
paul sauv
Associate III
May 1, 2018
Question

STM32F103 LCD20x4 i2C

  • May 1, 2018
  • 6 replies
  • 8129 views
Posted on May 01, 2018 at 06:29

Good morning,

I'm beginner with STM but managed to get working a STM32F103 LCD16x2 using i2C

Now, I would like to use i2C but with 20x4 LCD, nothing fancy

I modified the library according to what I was thinking correct but I can't get it working properly.

I used this tutorial for the 16x2 lcd:

http://controllerstech.com/i2c-lcd-in-stm32/

 

because I use this i2C module: 

PCF8574

And the LCD screen 20x4:

https://www.aliexpress.com/item/2PCS-Lot-LCD-Board-2004-20-4-LCD-20X4-5V-Blue-Screen-LCD-2004A-Display-LCD/32637673263.html

 

I have weird characters wrote on the LCD but not at the good position and not what it's supposed to be displayed

The project is attached

Do you have any idea of what I did wrong ?

Thank you

#lcd-display #i2c #stm32f103
This topic has been closed for replies.

6 replies

waclawek.jan
Super User
May 1, 2018
Posted on May 01, 2018 at 10:04

Observe, what's on the LCD pins, by a logic analyzer, and compare that to HD44780 datasheet.

JW

paul sauv
paul sauvAuthor
Associate III
May 3, 2018
Posted on May 03, 2018 at 10:48

Unfortunately I don't know how to do that...

I changed the I2C address for 0x27 which seems to be the correct one when A1, A2 and A3 are low, but not working either

henry.dick
Associate II
May 3, 2018
Posted on May 03, 2018 at 13:03

Easy.

1. Read the LCD datasheet and see how it works. Sending data to four lines is just starting at different addresses.

2. Read the i2c expanders datasheet and schematic to see how to send the commands

3. Done.

Cannot be simpler than that.

paul sauv
paul sauvAuthor
Associate III
May 16, 2018
Posted on May 16, 2018 at 14:36

Good afternoon,

I made some progress:

Use slave address 0x27<<1 diplay the correct first row

But when i'm supposed to display to the following row, nothing.

Idon't understand because I use common display and I2C odule, this is strange.

Here is the whole project

https://drive.google.com/open?id=1gIY039_RFFDAfFDW0_sDU0ZDy4AEFY8E

 

Any help is appreciated

Thank you

T J
Senior III
May 16, 2018
Posted on May 16, 2018 at 14:50

not sure exactly, but

some displays will display the 21st character on the next line

and other displays need a CR to go the 2nd line.

its in the datasheet.

what page are you reading ?

send us the link to the data sheet.

paul sauv
paul sauvAuthor
Associate III
May 16, 2018
Posted on May 16, 2018 at 14:52

Hi

I think this is the correct datasheet:

https://www.sparkfun.com/datasheets/LCD/HD44780.pdf

 
MHoch.3
Associate
January 18, 2019

Hello,

it seams this task is quite a long time in process. Did you manage to get it running? I'm looking for the exact same.

DTodo
Explorer
April 26, 2020

Hi,

if you are still interested I am working on an I2C LCD (PCF5874T + HD44780) library for STM32F1x. It's still WIP, but you can check it out

https://github.com/meteowrite/stm32_i2cLcd

Cheers,

-

DTodo
Explorer
November 11, 2020

Hey there,

in the past I've worked with the same LCD+I2C combination. You may check it out on github, see if it helps:

https://github.com/meteowrite/stm32_i2cLcd

Br,

Dimitar