Anyone had it working with Adafruit screens?

What do you want to achieve?

I’d like to get it running with the Adafruit touchscreen displays as we have them integrated into deployed systems and I’d really like to upgrade the visuals on them. I can get the buttons, images etc. to work - but the touch doesn’t. I’m guessing it is because the STMPE610 which is the touchscreen controller isn’t supported.

What have you tried so far?

I’ve tried a few different ways but cannot seem to get it to work. I’ve tried:

  1. The Adafruit lvgl library “adafruit_lvgl_glue”. It just throws up an error and the screen flashes.

Rebooting…
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13132
load:0x40080400,len:3036
entry 0x400805e4
Guru Meditation Error: Core 1 panic’ed (StoreProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x400ecf4f PS : 0x00060830 A0 : 0x800ecf79 A1 : 0x3ffb2700
A2 : 0x00000000 A3 : 0x00060623 A4 : 0x00060620 A5 : 0x00000001
A6 : 0x007ba754 A7 : 0x003fffff A8 : 0x00000000 A9 : 0x00000000
A10 : 0x00000480 A11 : 0x3ffc30b4 A12 : 0x00000004 A13 : 0x00060623
A14 : 0x00060623 A15 : 0x00000001 SAR : 0x00000020 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000008 LBEG : 0x40089e29 LEND : 0x40089e39 LCOUNT : 0xffffffed

Backtrace: 0x400ecf4c:0x3ffb2700 0x400ecf76:0x3ffb2720 0x400eb3cf:0x3ffb2740 0x400d6bf3:0x3ffb2760 0x400d28ee:0x3ffb2780 0x400d29fd:0x3ffb27d0 0x400d2531:0x3ffb27f0 0x400f7f26:0x3ffb2820


  1. Touch_Controller_Demo from the TFT_eSPI library. Touch does not work
  2. Squareline demos - again, the touch does not work.

Any help would be greatly appreciated!

Screenshot or video

The UI arduino file is standard:

#include <lvgl.h>
#include <TFT_eSPI.h>
#include <ui.h>

/Change to your screen resolution/
static const uint16_t screenWidth = 240;
static const uint16_t screenHeight = 320;

static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * screenHeight / 10 ];

TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */

#if LV_USE_LOG != 0
/* Serial debugging */
void my_print(const char * buf)
{
Serial.printf(buf);
Serial.flush();
}
#endif

/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );

tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();

lv_disp_flush_ready( disp );

}

/Read the touchpad/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
uint16_t touchX = 0, touchY = 0;

bool touched = tft.getTouch( &touchX, &touchY, 600 );

if( !touched )
{
    data->state = LV_INDEV_STATE_REL;
}
else
{
    data->state = LV_INDEV_STATE_PR;

    /*Set the coordinates*/
    data->point.x = touchX;
    data->point.y = touchY;

    Serial.print( "Data x " );
    Serial.println( touchX );

    Serial.print( "Data y " );
    Serial.println( touchY );
}

}

void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */

String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();

Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );

lv_init();

#if LV_USE_LOG != 0
lv_log_register_print_cb( my_print ); /* register print function for debugging */
#endif

tft.begin();          /* TFT init */
tft.setRotation( 2 ); /* Landscape orientation, flipped */

uint16_t coords[5] = { 323, 3474, 412, 3442, 4 };
tft.setTouch(coords);


lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * screenHeight / 10 );

/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );

/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );


ui_init();

Serial.println( "Setup done" );

}

void loop()
{
lv_timer_handler(); /* let the GUI do its work */

uint16_t x, y;

tft.getTouchRaw(&x, &y);

delay(5);

}


I have modified Setup42 to get the pins correct:

/ See SetupX_Template.h for all options available
#define USER_SETUP_ID 42

#define ILI9341_DRIVER

/* ROSS WHAT IT WAS WHEN IT WORKS FOR SAMD21 Feather M0 and TFT featherwing 2.4 inch

#define TFT_MISO 19 // (leave TFT SDO disconnected if other SPI devices share MISO)
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 33 //ROSS originally pin 2 - but for featherwing it is 33 // Data Command control pin
#define TFT_RST 4 // Reset pin (could connect to RST pin)

// Optional touch screen chip select
//#define TOUCH_CS 5 // Chip select pin (T_CS) of touch screen

//ROSS END OF WHAT IT WAS */

//ROSS FOR FEATHER M0 and featherwing - attempting to turn touh on

//ROSS #define TFT_MISO 19 // (leave TFT SDO disconnected if other SPI devices share MISO)
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 33 //ROSS originally pin 2 - but for featherwing it is 33 // Data Command control pin
#define TFT_RST 4 // Reset pin (could connect to RST pin)

// Optional touch screen chip select
#define TOUCH_CS 32 // Chip select pin (T_CS) of touch screen

#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

// TFT SPI clock frequency
#define SPI_FREQUENCY 20000000
// #define SPI_FREQUENCY 27000000
//ROSS WAS THIS: #define SPI_FREQUENCY 40000000
// #define SPI_FREQUENCY 80000000

// Optional reduced SPI frequency for reading TFT
#define SPI_READ_FREQUENCY 16000000

// SPI clock frequency for touch controller
#define SPI_TOUCH_FREQUENCY 2500000


Others

  • SquareLine Studio version: 1.3.0
  • Operating system: Windows 10
  • Target hardware: Sparkfun Thing Plus C with Adafruit Featherwing 2.4inch TFT (ILI9341 display and STMPE610 touch)

Next Lego player. Showed zero info. Resistive Touch Screen | Adafruit 2.4" TFT FeatherWing | Adafruit Learning System

Not sure what you are referring to here. I’ve had it running nicely with other screens and microcontrollers, just not this specific combination. I thought I’d ask if anyone has had it running on that combo.
Thanks
Ross