/MicroPython_LilyGO_T_Display_S3

MicroPython for LilyGo T-Display S3 + S3LCD display driver

Primary LanguagePythonMIT LicenseMIT

⚠️ Micropython + SmartConfig now in his own Repo here ⚠️

MicroPython + S3LCD para LilyGo T-Display S3 ESP32-S3-WROOM-1-N16R8

Datasheet:

Docs:

LilyGO T-Display S3

ESP-IDF:

MicroPython

MicroPython LilyGO T-Display S3 + S3LCD Driver

Probado en -- Tested on Ubuntu WSL 2024:

  • wsl --install Ubuntu

Wsl

Una vez instalado Ubuntu -- Once Installed Ubuntu:

Actualizar e instalar requerimientos -- Update and Install Requirements:

  • sudo apt update && sudo apt upgrade -y

    Update

  • sudo apt install -y build-essential git wget flex bison gperf pkg-config python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0

    Dependencias

Clonar ésta repo -- Clone this repo, MicroPython y ESP-IDF compatible con MicroPython(En la actualidad "Micropython 1.24" 5.04 a 5.2.2):

  • git clone https://github.com/PIBSAS/MicroPython_LilyGO_T_Display_S3.git

    Clone Repo

  • git clone https://github.com/micropython/micropython.git

    Clone Micropython

ESP-IDF v5.0.4:

  • mkdir esp
    cd esp
    git clone -b v5.0.4 --recursive https://github.com/espressif/esp-idf.git
    Clone ESP-IDF

ESP-IDF v5.2:

  • mkdir esp
    cd esp
    git clone -b v5.2 --recursive https://github.com/espressif/esp-idf.git

ESP-IDF v5.2.2:

  • mkdir esp
    cd esp
    git clone -b v5.2.2 --recursive https://github.com/espressif/esp-idf.git

Instalar CMake mediante -- Install CMake with idf_tools.py:

  • cd esp-idf/tools
  • python3 idf_tools.py install cmake

    CMAKE Install

Regresar un directorio y ejecutar el script para ESP32S3 -- Back a directory and execute the Script for ESP32S3:

  • cd ..
    ./install.sh esp32s3
    Install

Ejecutar -- Run:

  • . ./export.sh

Export Script

Copiar el directorio ESP32_GENERIC_S3_N16R8 y su contenido al directorio boards -- Copy recursively ESP32_GENERIC_S3_N16R8 folder and his content to boards folder:

  • cd
    cp -r ESP32-S3-WROOM-1-N16R8/ESP32_GENERIC_S3_N16R8 micropython/ports/esp32/boards

Copy

Dirigirnos al directorio MicroPython y ejecutar mpy-cross -- Go to MicroPython folder and run mpy-cross:

  • cd
    cd micropython/
    make -C mpy-cross

Make Mpy

Indicar el IDF_TARGET -- Indicate IDF_TARGET:

  • export IDF_TARGET=esp32s3

IDF-Target

Movernos a -- Move to ports/esp32:

  • cd ports/esp32/

Compilar MicroPython para ESP32 S3 -- Compile MicroPython for ESP32 S3:

  • make BOARD=ESP32_GENERIC_S3_N16R8 submodules
  • make BOARD=ESP32_GENERIC_S3_N16R8

Makes

Al final con ESP-IDF v5.0.4 nos indica -- At the end show us with ESP-IDF v5.0.4:

  • Project build complete. To flash, run this command:
  • $HOME/.espressif/python_env/idf5.0_py3.10_env/bin/python ../../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p (PORT) -b 460800 --before default_reset --after no_reset --chip esp32s3  write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

Success-Changed to new name folder

Or run 'idf.py -p (PORT) flash':

bootloader @0x000000 18672 ( 14096 remaining)
partitions @0x008000 3072 ( 1024 remaining)
application @0x010000 1396208 ( 635408 remaining)
total 1461744
  • Se debe cambiar (PORT) por COM29 por ejemplo o en linux /dev/ttyACM0

Al final con ESP-IDF v5.2 nos indica -- At the end show us with ESP-IDF v5.2:

  • Project build complete. To flash, run this command:
  • python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

Success

Al final con ESP-IDF v5.2.2 nos indica -- At the end show us with ESP-IDF v5.2.2:

  • Project build complete. To flash, run this command:
  • python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

Windows:

ESP-IDF v5.0.4:

Borramos la flash -- Erase flash:

  • $HOME/.espressif/python_env/idf5.0_py3.10_env/bin/python ../../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyACM0 erase_flash

Erase Flash

Luego flasheamos -- Then flash:

  • $HOME/.espressif/python_env/idf5.0_py3.10_env/bin/python ../../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p COM29 -b 460800 --before default_reset --after no_reset --chip esp32s3  write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

Flash

ESP-IDF v5.2:

  • python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

ESP-IDF v5.2.2:

  • python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

WSL:

Instalar -- Install USBIPD:

  • winget install --interactive --exact dorssel.usbipd-win

Abrir Terminal(Administrador) conectar el ESP32 y escribir -- Open Terminasl(Admin) plug ESP32 and type:

  • usbipd list
  • Observar el -- See BUSID del -- of esp (USB-Enhanced-SERIAL CH343 (COM29). Ej: 2-1

Escribir -- Type:

  • usbipd bind --busid 2-1
  • usbipd attach --wsl --busid 2-1

En WSL Ubuntu(Distro) agregar el usuario al grupo dialout -- On WSL Ubuntu add user to dialout group:

  • sudo adduser $USER dialout

En Terminal(Administrador) Comprobar que figure Attached en la columna STATE con -- On Teminal(Admin) Verify Attached on STATE column with:

  • usbipd list

ESP-IDF v5.0.4:

Luego en WSL borramos la flash -- Then on WSL erase the flash:

  • $HOME/.espressif/python_env/idf5.0_py3.10_env/bin/python ../../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyACM0 erase_flash

Luego flasheamos -- Then flash:

  • $HOME/.espressif/python_env/idf5.0_py3.10_env/bin/python ../../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyACM0 -b 460800 --before default_reset --after no_reset --chip esp32s3  write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

ESP-IDF v5.2:

  • python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

ESP-IDF v5.2.2:

  • python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

After flash detach the board with usbipd so is available for Windows:

  • usbipd detach --busid 2-1

Linux:

  • $HOME/.espressif/python_env/idf5.0_py3.10_env/bin/python ../../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyACM0 erase_flash
  • $HOME/.espressif/python_env/idf5.0_py3.10_env/bin/python ../../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyACM0 -b 460800 --before default_reset --after no_reset --chip esp32s3  write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin

Reference

The Lazy way:

  • Just Download the bin Firmware files.

⚠️ Files need to be where is esptool or type full path of files ⚠️

Install ESPtool:

  • pip install esptool

Replace (PORT)"Doesn't need port", with yours Linux: /dev/ttyACM0 Windows: COM12 (After com goes the number detected on your pc)

Erase flash:

  • Linux(On Ubuntu python3 instead just python): python -m esptool erase_flash
  • Windows: python -m esptool erase_flash
  • Windows with Virtual Environment: esptool erase_flash

Flash:

  • python -m esptool -b 460800 --before default_reset --after no_reset --chip esp32s3  write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin 0x10000 micropython.bin

Windows with Virtual Environment:

  • esptool -b 460800 --before default_reset --after no_reset --chip esp32s3  write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin 0x10000 micropython.bin

⚠️ For pip on newest OSes you need to make virtual environment:

Windows:

  • python -m venv esp-env

or

  • py -m venv esp-env
    .\esp-env\Scripts\activate

Once activated install esptool:

  • (esp-env)PS C:....> pip install esptool

NOTE IN WINDOWS:

  • If you get a PowerShell Scripts Policy Execution Exception that don't let you activate the Virtual Environment:
.\esp-env\Scripts\activate
  • Then open a Terminal like Administrator and type:
Set-ExecutionPolicy Unrestricted
  • Close the Terminal now you can activate the Python Virtual Environment.

Linux:

  • python .m venv esp-env
    source esp-env/bin/activate

Once activated install esptool:

  • (esp-env) ...$: pip install esptool

ESP Tool Docs:

If you want add Libraries to your build, then copy them to micropython/ports/esp32/modules/ folder all *.py you want, look the space left, becarefull.

Smartconfig Apps from: