ESP32 (WT32-SC01) problems getting started

What do you want to achieve?

i would like to be pointed in the direction of a arduino sketch that will work with my esp board,i have the project exported and included in the the arduino ide,im just not sure what to put in the main sketch file to make this thing all come together

What have you tried so far?

a few youtube tutorials but not luck or clear explanation

Screenshot or video

Others

  • SquareLine Studio version: 1.1.0
  • Operating system: windows
  • Target hardware: esp32 wt32-sc01 touch screen dev-board

Have you exported the Arduino project from SquareLine? If so, please take a look at the README.

Basically you can configure the pin connection in libraries/TFT_eSPI/User_Setup.h .

Hi, have similar problems to get a very small example up and running on WT32-SC01 3.5".
I handmade already some lvgl / TFT_eSPI GUI’s for that board, so the pin connection seems to be correct.
My Squareline example contains only 5 objects, is my starting point to verify that the flow is working.
Simulation works as expected.
Export->Create Template Project worked fine.
Compile ( Arduino ) and upload successful.
But then I get only random pattern, so there is nothing written to the LCD.
For test reasons I add
tft.fillScreen(TFT_YELLOW);
at the end of setup()
Then the display is filled yellow. ( works fine with other colors, also )

So there is something wrong with my setup.
I’m on Windows 11, all available updated are installed.

I tried other lvgl / TFT_eSPI examples, independent from Squareline, they are working fine.
I expect, there is something wrong in my setup. I’m unable to find it. Spent a lot of time, watch interesting videos, but still hanging.

Any idea?
Thanks in advance
Pepito

I forgot, Pin connections for that board:
#define TFT_MISO 12
#define TFT_MOSI 13
#define TFT_SCLK 14
#define TFT_CS 15
#define TFT_DC 21
#define TFT_RST 22
#define TFT_BL 23

Try this code, I think he is using same displey. You can see here how it works. I hope it helps.

Thanks, this dis help a little bit.
Random pattern are gone, display is dark, I’m able to dimm the backlight.
But I’m still missing the generated UI … that one works in simulation.
Compile, upload, everything is ok, no warning, no error.
#define LV_TICK_CUSTOM 1 … of course :smirk:

Any idea or has somebody a very small example for the WT32-SC01 3.5" board?
Thanks and have a good day
Pepito

/* My ui.ino */
#include <lvgl.h>
#include “ui.h”
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include <FT6236.h>
#define SDA_FT6236 18
#define SCL_FT6236 19
FT6236 ts = FT6236();

class LGFX : public lgfx::LGFX_Device
{
lgfx::Panel_ST7796 _panel_instance;
lgfx::Bus_SPI _bus_instance; // SPI
lgfx::Light_PWM _light_instance;

public:
LGFX(void)
{
{ //
auto cfg = _bus_instance.config(); //
cfg.spi_host = VSPI_HOST; // (VSPI_HOST or HSPI_HOST)
cfg.spi_mode = 0; // SPI(0 ~ 3)
cfg.freq_write = 40000000; //
cfg.freq_read = 16000000; //
cfg.spi_3wire = false; // MOSI true
cfg.use_lock = true; //
cfg.dma_channel = 1; // Set the DMA channel (1 or 2. 0=disable)
cfg.pin_sclk = 14; // SPIのSCLK
cfg.pin_mosi = 13; // SPIのMOSI
cfg.pin_miso = 12; // SPIのMISO
cfg.pin_dc = 21; // SPIのD/C (-1 = disable)
_bus_instance.config(cfg); //
_panel_instance.setBus(&_bus_instance); //
}

{ //
  auto cfg = _panel_instance.config();    // 
  cfg.pin_cs           =    15;  // CS(-1 = disable)
  cfg.pin_rst          =    22;  // RST(-1 = disable)
  cfg.pin_busy         =    -1;  // BUSY(-1 = disable)
  cfg.memory_width     =   320;  // 
  cfg.memory_height    =   480;  //
  cfg.panel_width      =   320;  //
  cfg.panel_height     =   480;  //
  cfg.offset_x         =     0;  //
  cfg.offset_y         =     0;  //
  cfg.offset_rotation  =     0;  //
  cfg.dummy_read_pixel =     8;  //
  cfg.dummy_read_bits  =     1;  //
  cfg.readable         =  true;  //
  cfg.invert           = false;  //
  cfg.rgb_order        = false;  //
  cfg.dlen_16bit       = false;  //
  cfg.bus_shared       =  true;  //

  _panel_instance.config(cfg);
}

{ //
  auto cfg = _light_instance.config();    //

  cfg.pin_bl = 23;              //
  cfg.invert = false;           // true
  cfg.freq   = 44100;           //
  cfg.pwm_channel = 7;          //

  _light_instance.config(cfg);
  _panel_instance.setLight(&_light_instance);  //
}

setPanel(&_panel_instance); //

}
};

LGFX tft;

/Change to your screen resolution/
static const uint32_t screenWidth = 320;
static const uint32_t screenHeight = 480;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];

/* 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.writePixels((lgfx::rgb565_t *)&color_p->full, w * h);
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 )
{
if(ts.touched()){
data->state = LV_INDEV_STATE_PR;
TS_Point p = ts.getPoint();
data->point.x = p.y;
data->point.y = tft.height() - p.x;
}else{
data->state = LV_INDEV_STATE_REL;
}
}

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

tft.begin();
tft.setRotation(1);
tft.setBrightness(255); // works fine

if(!ts.begin(40, SDA_FT6236, SCL_FT6236)){ // works fine
Serial.println(“Unable to start the capacitive touch Screen.”);
}

lv_init();
Serial.println(“lv_init done”);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );

/Initialize the display/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
Serial.println(“Display Init done”);
/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);
Serial.println(“Set Display Properties done”);
/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);
Serial.println(“Set Dummy Input Device done”);
ui_init();
Serial.println(“ui_init() done”);
}

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

I start from scratch again, now it works with my own simple example. It’s a good starting point.
Touch is working fine…
But I’m unable to make the audio mixer example work on my device.
I set the width = 320, height = 480, resize and move some objects, that everything fits on screen,
but the result is only a white screen :slight_smile:
Touch is not operating ( have no debug outputs ).
I expect, the process is hanging on some place, or not started.
But my own stuff has priority … :wink:
Thanks and have a good day
Pepito

Please enable logging to see id LVGL has some errors or warnings. I think it’s an out-of-memory issue.

Can you happen to post your simple example? I’m just starting with Squareline & WT32-SC01 and it would be a tremendous help to have something to start with. I will appreciate anything you can provide.

Mike

Hi Mike,

I’m currently not at home.

It works fine with that board.

With touch.

Going to send you my template.

Then generate only your specific ui files.

Do not update / overwrite the template.

Check libraries, often there ist some stuff missing, e.g. for touch.

Have a good day

Peter

here is the tmplate.ino:
#include “lvgl.h”
#include “ui.h”
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include <FT6236.h>
#define SDA_FT6236 18
#define SCL_FT6236 19
FT6236 ts = FT6236();

public:
LGFX(void)
{
{ //
auto cfg = _bus_instance.config(); //
cfg.spi_host = VSPI_HOST; // (VSPI_HOST or HSPI_HOST)
cfg.spi_mode = 0; // SPI(0 ~ 3)
cfg.freq_write = 40000000; //
cfg.freq_read = 16000000; //
cfg.spi_3wire = false; // MOSI true
cfg.use_lock = true; //
cfg.dma_channel = 1; // Set the DMA channel (1 or 2. 0=disable)
cfg.pin_sclk = 14; // SPIのSCLK
cfg.pin_mosi = 13; // SPIのMOSI
cfg.pin_miso = 12; // SPIのMISO
cfg.pin_dc = 21; // SPIのD/C (-1 = disable)
_bus_instance.config(cfg); //
_panel_instance.setBus(&_bus_instance); //
}

{ //
  auto cfg = _panel_instance.config();    // 
  cfg.pin_cs           =    15;  // CS(-1 = disable)
  cfg.pin_rst          =    22;  // RST(-1 = disable)
  cfg.pin_busy         =    -1;  // BUSY(-1 = disable)
  cfg.memory_width     =   320;  // 
  cfg.memory_height    =   480;  //
  cfg.panel_width      =   320;  //
  cfg.panel_height     =   480;  //
  cfg.offset_x         =     0;  //
  cfg.offset_y         =     0;  //
  cfg.offset_rotation  =     0;  //
  cfg.dummy_read_pixel =     8;  //
  cfg.dummy_read_bits  =     1;  //
  cfg.readable         =  true;  //
  cfg.invert           = false;  //
  cfg.rgb_order        = false;  //
  cfg.dlen_16bit       = false;  //
  cfg.bus_shared       =  true;  //

  _panel_instance.config(cfg);
}

{ //
  auto cfg = _light_instance.config();    //

  cfg.pin_bl = 23;              //
  cfg.invert = false;           // true
  cfg.freq   = 44100;           //
  cfg.pwm_channel = 7;          //

  _light_instance.config(cfg);
  _panel_instance.setLight(&_light_instance);  //
}

setPanel(&_panel_instance); //

}
};

LGFX tft;

static const uint32_t screenWidth = 480;
static const uint32_t screenHeight = 320;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];

/* 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.writePixels((lgfx::rgb565_t *)&color_p->full, w * h);
tft.endWrite();

lv_disp_flush_ready( disp );
}

void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
if(ts.touched())
{
data->state = LV_INDEV_STATE_PR;
TS_Point p = ts.getPoint();
data->point.x = p.y;
data->point.y = tft.height() - p.x;
// Serial.print( "Data x " );
// Serial.println( data->point.x );

// Serial.print( "Data y " );
// Serial.println( data->point.y );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}

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

tft.begin();
tft.setRotation(1);
tft.setBrightness(255); // works fine

if(!ts.begin(40, SDA_FT6236, SCL_FT6236)){
Serial.println(“Unable to start the capacitive touch Screen.”);
}

lv_init();
Serial.println(“lv_init done”);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );

/Initialize the display/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
Serial.println(“Display Init done”);
/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);
Serial.println(“Set Display Properties done”);
/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);
Serial.println(“Set Dummy Input Device done”);
ui_init();
Serial.println(“ui_init() done”);
// tft.fillScreen(TFT_YELLOW);
}

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

one level up …/libraries/ you need the following in it:

Thank you! I really appreciate it. I’m sure this is going to save me a lot of time!

Mike

Please go to this URL and select the firmware and flash it.
You only need a Browser and a USB cable.
https://iot.sukesh.me

Arduino sample is here

Integration with SquareLine Studio coming soon.

hello

I also buy the wt32-sc01 plus
on the other hand I want to upload the program from arduino IDE 2.0. is it possible.

because i am using esp32-dev module, with com port 12 on my pc.
the arduino ide compiles the program but fails to flash the esp32

am I making a mistake?

I thank you

I found this: GitHub - FCam1/SC01_Plus_HMI_example: Arduino example using SquareLine Studio to make an HMI with an SC01_plus capacitive display.

It works perfect on my SC01 Plus. I just copy the files from squareline after exporting them