Resolving issues with Lolin ESP32 S3 Pro

Another variation on S3

I had been using several S3 chips for touch screen and AI projects. This one attracted my attention for the advantages of screen connector, battery management, SD card onboard and size. So I bought three. One to blow up, one to work on and a spare.

Getting it to cooperate is a challenge, so I thought that my experience might be useful. Once setup, these boards are quick and so far proving to be very reliable.


Touchscreen connection

I make use of ILI9341 and ST77989 type TFT touch displays and have over the years found them most satisfactory. Usually I design PCB boards to take care of the numerous wires that these boards need for SPI.

This board has a 10 pin single row SH1.0 plug that can connect to a TFT display. Using this cable https://www.aliexpress.com/item/32848833474.html
It will connect to ILI9341 display but needs wiring.

For testing I made up the cable pictured below for testing on breadboard:

Screenshot

Note that Pin 1 is closest to the SD card reader. (Black wire on this cable). Don’t take my colours for granted!

Also link up the MOSI, MISO, SCK lines to the Touch T_DIN,T_DO, T_CLK for Touch to work.
MOSI <=> T_DIN, MISO <=> T_DO, SCK <=> T_CLK

Using TFT_eSPI, here is a setup that works with ILI9341:

#define USER_SETUP_ID 170

#define ILI9341_DRIVER
                   
#define TFT_CS   48 
#define TFT_MOSI 11 
#define TFT_SCLK 12 
#define TFT_MISO 13 
#define TFT_BL   14
#define TFT_DC    47 
#define TFT_RST   21 

#define TOUCH_CS 45 //Optional for Touch

#define LOAD_GLCD
#define LOAD_FONT2
#define LOAD_FONT4
#define LOAD_FONT6
#define LOAD_FONT7
#define LOAD_FONT8
#define LOAD_GFXFF

#define SMOOTH_FONT

// FSPI (or VSPI) port (SPI2) used unless following defined. HSPI port is (SPI3) on S3.
#define USE_HSPI_PORT 
// #define USE_FSPI PORT 
#define SPI_FREQUENCY  27000000
// #define SPI_FREQUENCY  40000000   // Maximum for ILI9341
#define SPI_READ_FREQUENCY  6000000 // 6 MHz is the maximum SPI read speed for the ST7789V
#define SPI_TOUCH_FREQUENCY 2500000

Missing LittleFS problem solved

The Partitioning options for this board available to Arduino are limited.
At the time of writing, none provides a partition for big apps, OTA and LittleFS uploads.
(**** 16M Flash, (3MB APP/9.9MB FATFS did work for me on occasion)

This is a workaround! Use at your own risk!

Partition information is described in ~ boards.txt where you can see the partition scheme for the lolin_s3_pro. In my case added an extra partition option for lolin_s3_pro:

In boards.txt I inserted lines just above the partitioning info for lolin_s3_pro (at 11193)

lolin_s3_pro.menu.PartitionScheme.app3M_spiffs9M_16MB=16M Flash (3MB APP/9.9MB LittleFS)
lolin_s3_pro.menu.PartitionScheme.app3M_spiffs9M_16MB.build.partitions=app3M_LittleFS9M_16MB
lolin_s3_pro.menu.PartitionScheme.app3M_spiffs9M_16MB.upload.maximum_size=3145728

The actual partitioning is located in tools/partitions

I created a file “app3M_LittleFS9M_16MB.csv” in tools/partitions.

# Name,   Type, SubType, Offset,  Size, Flagsnvs,      
data, nvs,     0x9000,  0x5000,otadata,  
data, ota,     0xe000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x300000,
app1,     app,  ota_1,   0x310000,0x300000,
spiffs,     data, spiffs,     0x610000,0x9E0000,
coredump, data, coredump,0xFF0000,0x10000,
# to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage

This was adapted from the existing “app3M_FATFS9M_16MB.csv by changing the ffat line to:

spiffs,     data, spiffs,     0x610000,0x9E0000,

Run “Tools > Reload Board Data” This is important.

Now there is a new definition for “16M Flash (3MB APP/9.9MB LittleFS”

Select this (revised) partitioning scheme…

Run a compile and upload (something that has a Data folder)

Then Upload LittleFS – Using Arduino (Shift-Command-P) > upload LittleFS.
Serial monitor must be closed.


Serial problems..

Set USB CDC On Boot -> Enabled <<< This gets disabled sometimes

 https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/tutorials/cdc_dfu_flash.html

My experience:

In my case, the board has only one USB-C socket, however it behaves as:

Two serial ports. One is just for uploads, the other is the one to set that will automatically switch to upload and then back to normal serial for monitor after It restarts.  Sometimes I need to switch manually to upload / monitor after reprogram and restart.

On my Example board:
Upload port identifies as : usbmodem21nnn1         
Running port identifies as : usbmodem3C84…. (Lolin S3 Pro)


Normal programming:
(A disk is mounted on the computer?!
This is normal if USB MSC on Boot is enabled)

  • Make sure that: USB CDC on Boot is Enabled
  • Upload mode: USB-OTG-CDC (TinyUSB)
  • USB Mode: USB OTG-CD Tiny USB)
    (causes temporary loss of the usb connection, but reboot is automatic and reconnect also !)
Normal Communications Settings

HANDY TIP: Use the Menu to change Serial ports, this works better than other menu controls of serial for some reason !


SD Card

The onboard SDCard could be a real advantage.

Can work with 16Gb disks, but is a bit fussy…
Some cards will not reinitialise after a boot, but need power cycle.

Thanks to Bodmer (again) the trick is getting it to use the correct SPI from TFT_eSPI, so in setup() initialise with:

if(!SD.begin(46,tft.getSPIinstance())){

Battery connector

Note that the JST2.0 battery plug may have unconventional polarity !

Left pin is marked +

Monitor Battery Level
While I haven’t tried it yet, pin3 can be used to monitor battery level. To enable this requires soldering the VBAT jumper the back of the board.


(This page still being added to 14/viii/2025….)