I’m having some problems getting my generic STM32F103C8T6 board (Blue Pill) to work with my 2×16 I2C LCD display.
I’m using LiquidCrystal_I2C library bundled with STM32duino and the following code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
pinMode(PC13, OUTPUT);
lcd.init();
}
void loop() {
digitalWrite(PC13, HIGH);
delay(500);
digitalWrite(PC13, LOW);
delay(500);
lcd.print("Hello world");
}
If the I2C scanner finds the device, then its wired up OK
So the issue is in the library, or your use of it.
In general you can’t expect a AVR library to work on the STM32.
Well, a lot of libraries work fine.
But the presumption I normally make is that a library may not work because they are often designed to use AVR specific functionality
Anyway
Post a link to the library, beause the only one I found that seemed to match was
http://wentztech.com/radio/arduino/files/LCDI2C.html
and it looks like you didnt call the functions correctly, i.e wrong paramaters were being passed
http://forum.arduino.cc/index.php?topic … msg2186521
I have not tested individual libraries, as life is too short
Check that your LCD hardware is the device that the library was intended to work with, and after that see if you can contact the person who submitted it to me
i.e look in

Yep, the library I used is indeed this one: https://github.com/rogerclarkmelbourne/ … rystal_I2C
I (too) simply presumed it had been deemed as working as it came with the stm32duino and was also mentioned here http://www.stm32duino.com/viewtopic.php?f=13&t=274, but apparently this is not as straightforward as I thought.
I’ll try to dig in to the library & contact the original author.
Btw.. Has anyone used these characted LCD:s with STM32 using some other library?
Thanks again!
I got the LCD working using this version of the LiquidCrystal_I2C library: https://github.com/fdebrabander/Arduino … 2C-library
For me it seems that the version bundled with stm32duino is newer (there is “Version 2.0” mentioned in the header file), but for some reason it doesn’t work for me. If I just find enough time & energy, I’ll try to figure out why.
Thanks for the update
<…>
For me it seems that the version bundled with stm32duino is newer (there is “Version 2.0” mentioned in the header file), but for some reason it doesn’t work for me. If I just find enough time & energy, I’ll try to figure out why.

I’m having some problems getting my generic STM32F103C8T6 board (Blue Pill) to work with my 2×16 I2C LCD display.
I’m using LiquidCrystal_I2C library bundled with STM32duino and the following code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
pinMode(PC13, OUTPUT);
lcd.init();
}
void loop() {
digitalWrite(PC13, HIGH);
delay(500);
digitalWrite(PC13, LOW);
delay(500);
lcd.print("Hello world");
}
I got the LCD working using this version of the LiquidCrystal_I2C library: https://github.com/fdebrabander/Arduino … 2C-library
For me it seems that the version bundled with stm32duino is newer (there is “Version 2.0” mentioned in the header file), but for some reason it doesn’t work for me. If I just find enough time & energy, I’ll try to figure out why.
I got the LCD working using this version of the LiquidCrystal_I2C library: https://github.com/fdebrabander/Arduino … 2C-library
For me it seems that the version bundled with stm32duino is newer (there is “Version 2.0” mentioned in the header file), but for some reason it doesn’t work for me. If I just find enough time & energy, I’ll try to figure out why.
as i normally run full warnings, i’m playing with warning/message pragmas and #ifdef etc; it’s visible
stephen
So I guess we should get rid of the one that was contributed as the standard one works ??
So I guess we should get rid of the one that was contributed as the standard one works ??
as i normally run full warnings, i’m playing with warning/message pragmas and #ifdef etc; it’s visible
stephen
Can someone post this as an issue on github, so i remember to remove it ?
Can someone post this as an issue on github, so i remember to remove it ?
That’s saved me a load of work.
I’ve actioned the pull request on the server, as I don’t need to pull etc to do this, as there is nothing to test, i.e as its just a removal
Thanks again
Roger
The LiquidCrystal_I2C library from the “official” author is working without modifications. Now the new library NewLiquidCrystal has encapsulated all known types of hardware connections, I2C included (actualy is a super library)
You will find the library here : https://bitbucket.org/fmalpartida/new-l … /wiki/Home
I didn’t test other types of connection, only I2C.
Only these files are needed for I2C:
I2CIO.h/cpp
LCD.h/cpp
LiquidCrystal_I2C.h/cpp
At stm32 part, I used Wire library with PB6=SCL and PB7=SDA
Two pullup 4K7 resistors at I2C are necessary.
LCD is a typical 16×2 device connected with these dirt cheap boards with PCF8574 (priced about 1$, many call them as LCM1602IIC)
Here is the definition line of lcd:
LiquidCrystal_I2C lcd(0x20,2,1,0,4,5,6,7,3,POSITIVE); /// Definition LCM1602 IIC
pulling the bluepill i2c lines to 3v3 with 3k3 – avoids any issue with 5v levels, switching levels are below 3v3, usually ttl, about 2v4 istr
stephen
I have had good results by using +5 to the display, a level shifter, and a non stm32duino program.
I have never had any luck while just using 3.3 volts even while trying to use the 4-bit parallel software.
The stm32duino programs compile and download fine but no display.
Believe me, I think I’ve tried just about every combination and at lest five different displays.
I’m using PB6 and PB7 and did use pullups with the setups that failed.
The traces on my much loved Tek 2232 looked fine, just no display in fact, not even boxes.
To add to this, the working setup does not work when powered through the ST-Link.
What’s the trick to operating on 3.3 volts.
Please comment!
FWIW please don’t take this as a negitive comment, I’ve had good luck with most of the other stuff.
Thanks,
Bert