PlatformIO Community

Unable to compile code

First let me start with an apology, if I have posted this on the wrong forum It may not be a PlatformIO error it may be the library i m using.
I have acquired a couple of 3.5 inch RPi LCD (A) V3 displays. they seem to be rip off’s of the Waveshare product same name. I have managed to get the one working using the excellent TFT_eSPI lib and PlatformIO. I wrote a very simple program to display lines of text, configured the User_Setup.h and low and behold got the text on the screen. Now to extend my knowledge and put the display through its paces I decided to try and run the examples from the library namely 480x320 Touch_controller_Demo and Graph_2. The touch will not down load and gives a compiler error TFT_eSPIhas has no such members calibratetouch, gettouch and settouch. Any help would be much appreciated .
Regards
John

In order to be of any kind of help, we need to see your platformio.ini and exact code you’re running, or a link to it.

Very Impressed with your speed of response I may be a lot slower .ini is

[env:az-delivery-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
platform = espressif32

lib_extra_dirs = C:/Users/john/Documents/Arduino/libaries
lib_deps = 
 ;Ticker-esp32
 TinyGPSPlus
TFT_eSPI
 ;Timezone
 ;Dusk2Dawn
 Adafruit GFX Library
MCUFRIEND_kbv
 Adafruit BusIO
 Wire
impulseadventure/Waveshare ILI9486@^2.0.1
monitor_speed = 115200
upload_port = COM17
src_dir = C:/Users/john/Documents/platformIO/Projects/Outside Lites/.pio/libdeps/az-delivery-devkit-v4/TFT_eSPI/Examples

The code is the example
Code is TFT_SPI/examples/480x320/Touch_Controller_Demo.cpp. If you require any further info please ask. (Not sure how to provide a link so I hope the project directory structure will help if not please advise.)
Regards
John

Why that? The sourcecode should be in the src/ folder of the project, not in its library dependencies, this is very weird. Also you’re pointing to the folder where all examples are and not the one specific example.

There are two libraries there which are not indented by space, this would be an invalid lib deps declaration. Are you sure you’ve copied it directly?

But if you take the time to declare all libraries in lib_deps, why include the whole Arduino library folder, too? You were already on the right track :smiley:

Also makes it hard to reproduce for me since I don’t know what you’ve installed in there.

Let me just take a different approach, I’ll come up with the correct, self-contained, platformio.ini that makes this TFT_SPI/examples/480x320/Touch_Controller_Demo.cpp example compile.

1 Like

Thanks again for your speed.
point One `src_dir = C:/Users ect
It was an attempt to get the example to run in a similar fashion to ASrduino IDE.
point Two ptlatformIO.ini
Sorry bad cut and paste the syntax is correct in the original.
point Three … lib_extra ect
In colloquial English “Belt and Braces” I was trying to correct an error and simply have not removed any redundant? entries. I under stand that you do not know the contents of my …/Arduino/libaries. but that shouldn’t effect a suitable solution.
Your “different approach” seems to be the best steep forward.
Regards
John

Thanks so far, The main problem not compiling was entirely my fault. I should have RTFM comments in one of the header files describe the non compile error and the reason, which is a failure to specify a control pin number. Unfortunately a number of programs that run on my ESP32 when down loaded via the Arduino IDE will not run satisfactorily, in fact not at all when down loaded via PlatformIO. The program is TFT_eSPI examples TFT_Meter_4 from the TFT_eSPI library and my ino file is below

[env:az-delivery-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
lib_extra_dirs = C:/Users/john/Documents/Arduino/libaries
lib_deps = 
    ;Ticker-esp32
    ;TinyGPSPlus
    TFT_eSPI
    ;Timezone
    ;Dusk2Dawn
    Adafruit GFX Library
    MCUFRIEND_kbv
    Adafruit BusIO
    Wire
    SPI
    SPIFFS
    ;impulseadventure/Waveshare ILI9486@^2.0.1
monitor_speed = 115200
upload_port = COM17

Other programs from the examples also run when down loaded via Arduino IDE but produce the same symptoms when down loaded via PlatformIO. In all cases I have checked the configurable header files and they are correct. Any hint or suggestions would be much appreciated.

How are you configuring the display in the Arduino IDE with the conig files?

By specifying driver files and by mapping IO for SPI .The method is to remove the comment specifiers from #define statements in two header files user_setup.h and user_select_setup.h. The options include
SPI frequency’s, GPIO Numbers, fonts and TFT chip driver files. The same header files are used by the Arduino IDE which does not produce the same problem. I have checked the header files stored with the PlatformIO project with the Arduino library equivalents and they are the same as far as I can see. I should reiterate that I am using the same ESP 32 connected in exactly the same way for both Arduino and PlatformIO down loads and that PlatformIO does not flag any errors and the download indicates success. I have tried limited debugging via Serial.print with little or no sucess. I have ordered a incircuit debugger so I may, when it arrives be able to further diagnose the problem. Thanks for your interest so far. Regards
John

Can you post these exact files here?

Sure The files are very repetitive so I have Cut and Pasted the relevant sections. Should you require the full files they are at https://github.com/Bodmer/TFT_eSPI.
User_Setup

// ##################################################################################

//

// Section 1. Call up the right driver file and any options for it

//

// ##################################################################################

// Define STM32 to invoke optimised processor support (only for STM32)

//#define STM32
// Defining the STM32 board allows the library to optimise the performance
// for UNO compatible "MCUfriend" style shields
//#define NUCLEO_64_TFT
//#define NUCLEO_144_TFT
// STM32 8 bit parallel only:
// If STN32 Port A or B pins 0-7 are used for 8 bit parallel data bus bits 0-7
// then this will improve rendering performance by a factor of ~8x
//#define STM_PORTA_DATA_BUS
//#define STM_PORTA_DATA_BUS
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
//#define TFT_PARALLEL_8_BIT
// Display type -  only define if RPi display
//#define RPI_DISPLAY_TYPE // 20MHz maximum SPI
// Only define one driver, the other ones must be commented out
//#define ILI9341_DRIVER
//#define ST7735_DRIVER      // Define additional parameters below for this display
//#define ILI9163_DRIVER     // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
#define ILI9486_DRIVER (note This is the correct driver for My TFT Display driver chip)
Omitted some lines in the same format.
// ##################################################################################
//
// Section 2. Define the pins that are used to interface with the display here
//
// ##################################################################################
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP   ######
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS   15  // Chip select control pin
#define TFT_DC    2  // Data Command control pin
#define TFT_RST   4  // Reset pin (could connect to RST pin)
//#define TFT_RST  -1  // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
#define TOUCH_CS 22    // Chip select pin (T_CS) of touch screen
//#define TFT_WR 22    // Write strobe for modified Raspberry Pi TFT only
Lines Omitted 
// ##################################################################################

//

// Section 4. Other options

//

// ##################################################################################
// Define the SPI clock frequency, this affects the graphics rendering speed. Too
// fast and the TFT driver will not keep up and display corruption appears.
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
// With an ILI9163 display 27 MHz works OK.
// #define SPI_FREQUENCY   1000000
// #define SPI_FREQUENCY   5000000
// #define SPI_FREQUENCY  10000000
// #define SPI_FREQUENCY  20000000
#define SPI_FREQUENCY  27000000 (This one selected)
// #define SPI_FREQUENCY  40000000
// #define SPI_FREQUENCY  55000000 // STM32 SPI1 only (SPI2 maximum is 27MHz)
// #define SPI_FREQUENCY  80000000
// Optional reduced SPI frequency for reading TFT
#define SPI_READ_FREQUENCY  20000000
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
#define SPI_TOUCH_FREQUENCY  25000000 (This one selected)
User_Setup_Select.h
Relevant sections only
#ifndef USER_SETUP_LOADED //  Lets PlatformIO users define settings in

                          //  platformio.ini, see notes in "Tools" folder.
// Only ONE line below should be uncommented.  Add extra lines and files as needed.
//#include <User_Setup.h>           // Default setup is root library folder
//#include <User_Setups/Setup1_ILI9341.h>  // Setup file configured for my ILI9341
//#include <User_Setups/Setup2_ST7735.h>   // Setup file configured for my ST7735
//#include <User_Setups/Setup3_ILI9163.h>  // Setup file configured for my ILI9163
//#include <User_Setups/Setup4_S6D02A1.h>  // Setup file configured for my S6D02A1
//#include <User_Setups/Setup5_RPi_ILI9486.h>        // Setup file configured for my stock RPi TFT
//#include <User_Setups/Setup6_RPi_Wr_ILI9486.h>     // Setup file configured for my modified RPi TFT
//#include <User_Setups/Setup7_ST7735_128x128.h>     // Setup file configured for my ST7735 128x128 display
//#include <User_Setups/Setup8_ILI9163_128x128.h>    // Setup file configured for my ILI9163 128x128 display
//#include <User_Setups/Setup9_ST7735_Overlap.h>     // Setup file configured for my ST7735
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for ESP8266 and RPi TFT with touch
#include <User_Setups/Setup11_RPi_touch_ILI9486.h> // Setup file configured for ESP32 and RPi TFT with touch
//#include <User_Setups/Setup12_M5Stack.h>           // Setup file for the ESP32 based M5Stack
//#include <User_Setups/Setup13_ILI9481_Parallel.h>  // Setup file for the ESP32 with parallel bus TFT
//#include <User_Setups/Setup14_ILI9341_Parallel.h>  // Setup file for the ESP32 with parallel bus TFT
//#include <User_Setups/Setup15_HX8357D.h>           // Setup file configured for HX8357D (untested)
//#include <User_Setups/Setup16_ILI9488_Parallel.h>  // Setup file for the ESP32 with parallel bus TFT
//#include <User_Setups/Setup17_ePaper.h>            // Setup file for any Waveshare ePaper display
//#include <User_Setups/Setup18_ST7789.h>            // Setup file configured for ST7789
//#include <User_Setups/Setup19_RM68140_Parallel.h>     // Setup file configured for RM68140 with parallel bus
//#include <User_Setups/Setup20_ILI9488.h>           // Setup file for ESP8266 and ILI9488 SPI bus TFT
//#include <User_Setups/Setup21_ILI9488.h>           // Setup file for ESP32 and ILI9488 SPI bus TFT
//#include <User_Setups/Setup22_TTGO_T4.h>           // Setup file for ESP32 and TTGO T4 version 1.2
//#include <User_Setups/Setup22_TTGO_T4_v1.3.h>      // Setup file for ESP32 and TTGO T4 version 1.3
//#include <User_Setups/Setup23_TTGO_TM.h>           // Setup file for ESP32 and TTGO TM ST7789 SPI bus TFT
//#include <User_Setups/Setup24_ST7789.h>            // Setup file configured for ST7789 240 x 240
//#include <User_Setups/Setup25_TTGO_T_Display.h>    // Setup file for ESP32 and TTGO T-Display ST7789V SPI bus TFT
//#include <User_Setups/Setup26_TTGO_T_Wristband.h>  // Setup file for ESP32 and TTGO T-Wristband ST7735 SPI bus TFT
//#include <User_Setups/Setup27_RPi_ST7796_ESP32.h>    // ESP32   RPi MHS-4.0 inch Display-B
//#include <User_Setups/Setup28_RPi_ST7796_ESP8266.h>  // ESP8266 RPi MHS-4.0 inch Display-B
//#include <User_Setups/Setup29_ILI9341_STM32.h>          // Setup for Nucleo board
//#include <User_Setups/Setup30_ILI9341_Parallel_STM32.h> // Setup for Nucleo board and parallel display
//#include <User_Setups/Setup31_ST7796_Parallel_STM32.h>  // Setup for Nucleo board and parallel display
//#include <User_Setups/Setup32_ILI9341_STM32F103.h>      // Setup for "Blue/Black Pill"
//#include <User_Setups/Setup33_RPi_ILI9486_STM32.h>      // Setup for Nucleo board
//#include <User_Setups/Setup34_ILI9481_Parallel_STM32.h> // Setup for Nucleo board and parallel display
//#include <User_Setups/Setup35_ILI9341_STM32_Port_Bus.h> // Setup for STM32 port A parallel display
//#include <User_Setups/Setup36_RPi_touch_ILI9341.h>      // Setup file configured for ESP32 and RPi TFT with touch
//#include <User_Setups/Setup43_ST7735.h>            // Setup file configured for my ST7735S 80x160
//#include <User_Setups/Setup44_TTGO_CameraPlus.h>   // Setup file for ESP32 and TTGO T-CameraPlus ST7789 SPI bus TFT    240x240
//#include <User_Setups/Setup45_TTGO_T_Watch.h>      // Setup file for ESP32 and TTGO T-Watch ST7789 SPI bus TFT  240x240
//#include <User_Setups/Setup47_ST7735.h>            // Setup file configured for ST7735 128 x 128 animated eyes
//#include <User_Setups/Setup50_SSD1963_Parallel.h>  // Setup file for ESP32 and SSD1963 TFT display
//#include <User_Setups/Setup135_ST7789.h>           // Setup file for ESP8266 and ST7789 135 x 240 TFT
//#include <User_Setups/SetupX_Template.h>
#endif // USER_SETUP_LOADED

I hope the above helps Regards
John

Hi All,
Seems my small problem is in some way insolvable, Ha Ho lets move on and leave that one in the “Regrets Basket”.
Thanks to all who have tried to help and I hope you have more success helping with the next “Simple problem”
By for Now
John