LCD I2C not working with STM32F103 and Arduino IDE

Working libraries, libraries being ported and related hardware
Post Reply
dacair
Posts: 3
Joined: Tue Jul 23, 2019 7:27 pm
OS: Win 10
IDE: Arduino
Board: Bluepill

LCD I2C not working with STM32F103 and Arduino IDE

Post by dacair » Tue Jul 23, 2019 7:51 pm

Hello,
I'm new to this forum. I do programming with controllers for small application that can help us in doing daily activities. So I'm not expert.
I used to use Arduino NANO hardware but recently I'm looking to upgrade to a better platform.

So I have got stm32f103c8t6 which looked well supported by Arduino IDE which I'm familiar.
I got the STM32 working with bootloader and did transfer an app from Arduino NANO to STM. That works fine.

Now going to my issue ...
I am using 20x4 and 16x2 I2C LCD displays. I downloaded :
hardware/Arduino_STM32 library
LiquidCrystal_I2C library

I am trying to make it work since couple of days, looking on different information on the net but still. LCD has power on, but do not show any text.
My thinking based on internet research is the speed on I2C is not ok, but I am still not able to resolve.
Is there a way I get help? We can use "Hello world!!" app. .
Thanks,

dacair
Posts: 3
Joined: Tue Jul 23, 2019 7:27 pm
OS: Win 10
IDE: Arduino
Board: Bluepill

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by dacair » Wed Jul 24, 2019 7:57 am

... to add some more details. The LCD is controlled by MCP23008

dacair
Posts: 3
Joined: Tue Jul 23, 2019 7:27 pm
OS: Win 10
IDE: Arduino
Board: Bluepill

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by dacair » Wed Jul 24, 2019 7:16 pm

Issue fixed ...
The library LiquidCrystal_I2C is for the PCF8563. It does not work with MCP23008
I'm real newbie :shock: ...

User avatar
Vassilis
Posts: 174
Joined: Wed Feb 27, 2019 5:09 pm
Answers: 2
Location: Thessaloniki, Greece
OS: Linux, Win10, MacOS
IDE: Arduino 1.8.9
Core: Roger, STM official
Board: Bluepill, Maple mini, STM32F4xx
Contact:

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by Vassilis » Thu Jul 25, 2019 6:24 am

Maybe you could try the Adafruit-MCP23008-library
-Vassilis Serasidis

User avatar
mack
Posts: 37
Joined: Fri Mar 08, 2019 7:59 pm
Location: Australia
OS: Windows 10
IDE: Arduino 188
Core: Roger (BluePill),StevStrong (F407 Black)
Board: BluePill,F407 Black

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by mack » Wed Aug 07, 2019 12:48 pm

I'm sorry about this question but with the old forum shutdown .....

Which is the recommended LiquidCrystal_12c library?

Can someone post an example "Hello_World"

I'm used to using it with arduino but I've never used i2c with the stm32.

Thanks

User avatar
Vassilis
Posts: 174
Joined: Wed Feb 27, 2019 5:09 pm
Answers: 2
Location: Thessaloniki, Greece
OS: Linux, Win10, MacOS
IDE: Arduino 1.8.9
Core: Roger, STM official
Board: Bluepill, Maple mini, STM32F4xx
Contact:

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by Vassilis » Wed Aug 07, 2019 2:25 pm

LiquidCrystal_PCF8574 library works out-of-the-box on STM Official Core + BluePill. You can download it through Arduino IDE (LiquidCrystal_PCF8574)

BluePillPCF8574
PB6SCL
PB7SDA


Example is included in the library
-Vassilis Serasidis

User avatar
mack
Posts: 37
Joined: Fri Mar 08, 2019 7:59 pm
Location: Australia
OS: Windows 10
IDE: Arduino 188
Core: Roger (BluePill),StevStrong (F407 Black)
Board: BluePill,F407 Black

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by mack » Wed Aug 07, 2019 10:03 pm

Thanks Vassilis

I did spend a few hours first trying to get a definitive answer.

Cheers
Andrew

fredbox
Posts: 6
Joined: Fri Jul 26, 2019 2:27 pm

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by fredbox » Wed Aug 07, 2019 11:31 pm

Also be aware there are at least three different versions of the I2C lcd adapter. See http://arduinoinfo.mywikis.net/wiki/LCD ... _Interface for more info. The ones I bought were version 3.

User avatar
Vassilis
Posts: 174
Joined: Wed Feb 27, 2019 5:09 pm
Answers: 2
Location: Thessaloniki, Greece
OS: Linux, Win10, MacOS
IDE: Arduino 1.8.9
Core: Roger, STM official
Board: Bluepill, Maple mini, STM32F4xx
Contact:

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by Vassilis » Wed Aug 07, 2019 11:49 pm

Generally, those kind of I2C lcd adapters use address 0x27 but you can find your own adapter address by using the following scanner sketch

Code: Select all

// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011

#include <Wire.h>

void setup() 
{
  Serial.begin(115200);

  Serial.println();
  Serial.println("I2C scanner. Scanning ...");
  byte count = 0;

  Wire.begin();
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission(i);
    if (Wire.endTransmission() == 0) {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() 
{
}

I2C scanner. Scanning ...
Found address: 39 (0x27)
Done.
Found 1 device(s).
-Vassilis Serasidis

User avatar
mack
Posts: 37
Joined: Fri Mar 08, 2019 7:59 pm
Location: Australia
OS: Windows 10
IDE: Arduino 188
Core: Roger (BluePill),StevStrong (F407 Black)
Board: BluePill,F407 Black

Re: LCD I2C not working with STM32F103 and Arduino IDE

Post by mack » Thu Aug 08, 2019 2:34 am

Thanks again guys,
I wasn't if the wire library was the correct library either as that wasn't working.
A fresh arduino 188 install in portable mode sorted that out.
It's nice to have the up to date information :D

Cheers
Andrew

Post Reply