Problems using mbed examples for LCD displays with PlatformIO IDE


#1

Hi,
I’m trying to compile and use some simple mbed sample programs in the PlatformIO IDE (I’m using IDE for VSCode - Home 0.6.0 - Core 3.5.0)
The board I’m using is the NUCLEO-L073RZ.
The following example (managing an I2C 20x4 display already mounted I2C adapter PCF8574T, through the TextLCD library) works properly using the mbed online compiler (e.g. the test messages are regularly shown on the display).

#include <mbed.h>
#include <TextLCD.h>

// PCF8574T
#define SLAVEADDRESS 0x4E // Display 20x4 
//PCF8574AT
//#define SLAVEADDRESS 0x7E //Display 16x2 

// Instantiates an I2C object by assigning the SDA and SCL pins
//I2C i2c_lcd(PB_9,PB_8); // SDA, SCL //Display 16x2
I2C i2c_lcd(PB_7,PB_6); // SDA, SCL

// Instantiates a TextLCD_I2C object to managethe display via I2Cbus
//TextLCD_I2C lcd(&i2c_lcd,SLAVEADDRESS,  TextLCD::LCD16x2); // I2C exp: I2C bus, PCF8574AT Slaveaddress, LCD Type
TextLCD_I2C lcd(&i2c_lcd,SLAVEADDRESS,  TextLCD::LCD20x4); 

int main() {

// put your setup code here, to run once:
// Turn off the cursor
lcd.setCursor(TextLCD::CurOff_BlkOff);

// Cleans the screen
lcd.cls();
   
// Print on the screen
lcd.printf("Hi, Welcome to");

// points to the first column, second line of the display  
lcd.setAddress(0, 1);

// Print on the screen
lcd.printf("LCD display demo");
wait(1);

while(1) {
   // put your main code here, to run repeatedly:
lcd.cls();
wait(0.5);
lcd.printf("FIRST MESSAGE");
wait(0.5);
lcd.setAddress(0, 1);
lcd.printf("SECOND MESSAGE");
wait(0.5);
lcd.setAddress(0, 3);
lcd.printf("THIRD MESSAGE");
wait(0.5);/**/
}
}

If I try to compile the same code, and the library sources, regularly placed in the “lib” folder of the project, using the PlatformIO IDE, it seems to compile correctly but then nothing is shown (using the same Nucleo board and connections with the LCD display).

Archiving .pioenvs\nucleo_l073rz\libf82\libtextLCD.a
Linking .pioenvs\nucleo_l073rz\firmware.elf
Checking program size
text       data     bss     dec     hex filename
53020      2512    1640   57172    df54 .pioenvs\nucleo_l073rz\firmware.elf
Building .pioenvs\nucleo_l073rz\firmware.bin
Looking for upload disk...
Auto-detected: F:\
Uploading .pioenvs\nucleo_l073rz\firmware.bin
Firmware has been successfully uploaded.
(Some boards may require manual hard reset)
========================================================== [SUCCESS] Took 37.42 seconds ==========================================================

Other simpler examples I’ve tried (e.g. Blink led or Serial management) work correctly in both environments (mbed compiler and PlatformIO IDE)
I’m a newbie of PlatformIO environment, could you please help me to solve the problem?

Thanks in advance for your support!
Regards


#2

Could you add to your platformio.ini file next line to [env] section

[env:...]
...
lib_archive = false
..

#3

Many thanks for the feedback!
Unfortunately, adding the option you suggested does not solve the problem.
The generated image does not behave as expected (no message shown on the display)
Any further suggestion that can help me to solve the problem is welcome!

    Linking .pioenvs\nucleo_l073rz\firmware.elf
Checking program size
text       data     bss     dec     hex filename
53028      2512    1640   57180    df5c .pioenvs\nucleo_l073rz\firmware.elf
Building .pioenvs\nucleo_l073rz\firmware.bin
Looking for upload disk...
Auto-detected: F:\
Uploading .pioenvs\nucleo_l073rz\firmware.bin
Firmware has been successfully uploaded.
(Some boards may require manual hard reset)
========================================================== [SUCCESS] Took 43.42 seconds ==========================================================

#4

Could you try the latest dev/platform?

[env:...]
platform = https://github.com/platformio/platform-ststm32.git