Arm Mbed OS support forum

Interfacing LCD 16X2 based on PC8574T to STM32L432KC

I have been trying to adapt a 16x2 lcd with several libraries to my l432kc core but I can’t get anything, mbed always throws errors with any library, if someone could help me with a simple Hello World I would be very grateful, greetings engineers from the world.


I use this TextLCD and also useful guide about all things around it.

The problem can be also in your I2C GPIO expander.


  • you need set up contrast via potentiometer
  • there are also some differences between expanders like different address or different setup of pins
  • verify your i2c address - code below

My recommendation is use the library what I posted and setup correct expander in the TextLCD_Config.h - it start on line 70.

For i2c scanner code click here
#include "mbed.h"

I2C i2c(I2C_SDA, I2C_SCL); 

int main(){
    printf("\nI2C Scanner running...\n");
    int error, address, nDevices;
    nDevices = 0;

    for(address = 0; address < 128; address++ ){
        error = i2c.write(address  << 1);
        error = i2c.write(address  << 1, "1", 1);
        //pc.printf("Erorr %d\n", error);
        if (error == 0){ //need to be change according to what version of overloaded write method is used
            printf("I2C device found at address 8bit: 0x%X 7bit: 0x%X\n", address, address << 1);
    if (nDevices == 0){
        printf("No I2C devices found\n");
For Example click here
#include "mbed.h"
#include "TextLCD.h"

DigitalOut led(LED1);
I2C i2cBus(I2C_SDA, I2C_SCL);
TextLCD_I2C lcd(&i2cBus, PCF8574_SA7, TextLCD::LCD16x2);

int main(){
    printf("LCD test\n");
    lcd.printf("LCD hello\n");


    while(1) {
        led = !led;

I use it with MbedOS6.5

BR, Jan