diff --git a/display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml b/display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml new file mode 100644 index 00000000..35c81eaf --- /dev/null +++ b/display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml @@ -0,0 +1,113 @@ +[MCU.esp32] +BOARD = "ESP32_GENERIC_S3" +BOARD_VARIANT = "SPIRAM_OCT" +flash_size = 16 +enable_jtag_repl = 'n' +enable_cdc_repl = 'n' +enable_uart_repl = 'y' +uart_repl_bitrate = 115200 + + +[RGBBus.display_bus] +data0 = 8 +data1 = 3 +data2 = 46 +data3 = 9 +data4 = 1 +data5 = 5 +data6 = 6 +data7 = 7 +data8 = 15 +data9 = 16 +data10 = 4 +data11 = 45 +data12 = 48 +data13 = 47 +data14 = 21 +data15 = 14 +hsync = 39 +vsync = 41 +de = 40 +pclk = 42 +freq = 10000000 +hsync_front_porch = 1 +hsync_back_porch = 32 +hsync_pulse_width = 50 +# hsync_idle_low defaults to false; vsync_idle_low is explicitly true per the +# official 4D Systems GFX4dESP32 library panel timing specification. +hsync_idle_low = false +vsync_front_porch = 1 +vsync_back_porch = 33 +vsync_pulse_width = 1 +vsync_idle_low = true +de_idle_high = false +pclk_idle_high = false +pclk_active_low = false + + +[I2C.Bus.i2c_bus] +host = 0 +scl = 18 +sda = 17 +freq = 400000 + + +[I2C.Device.indev_device] +bus = "i2c_bus" +dev_id = "ft5x46.I2C_ADDR" +reg_bits = "ft5x46.BITS" + + +[RGBDisplay.display] +data_bus = "display_bus" +display_width = 800 +display_height = 480 +backlight_pin = 2 +color_space = "lv.COLOR_FORMAT.RGB565" + + +[display.set_power] +params = [true] + + +[display.init] +params = [] + + +[FT5x46.indev] +device = "indev_device" + +[indev._cal.alphaX] +value = -0.011764519 + +[indev._cal.betaX] +value = 2.176436 + +[indev._cal.deltaX] +value = -4.7288592 + +[indev._cal.alphaY] +value = 2.270234 + +[indev._cal.betaY] +value = 0.0066771596 + +[indev._cal.deltaY] +value = 11.731292 + +[indev._cal.mirrorX] +value = false + +[indev._cal.mirrorY] +value = false + +[indev._cal.save] +params = [] + + +[display.set_backlight] +params = [100] + + +[task_handler.TaskHandler] +params=[] diff --git a/display_configs/Gen4-ESP32-70CT/README.md b/display_configs/Gen4-ESP32-70CT/README.md new file mode 100644 index 00000000..c5f74468 --- /dev/null +++ b/display_configs/Gen4-ESP32-70CT/README.md @@ -0,0 +1,57 @@ +# 4D Systems gen4-ESP32-70CT (LVGL MicroPython) + +This configuration targets the 4D Systems gen4-ESP32-70CT (800x480 capacitive touch). + +- Board info: `display_configs/Gen4-ESP32-70CT/board.json` +- TOML config: `display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml` + +## Build + +Run from the repository root: + +```bash +python make.py esp32 clean BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT --toml=display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml INDEV=ft5x46 +``` + +## Build + Flash in one step + +If the board is connected, you can build and flash directly: + +```bash +python3 make.py esp32 --toml=display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml deploy +``` + +Optional explicit serial settings: + +```bash +python3 make.py esp32 --toml=display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml PORT=/dev/ttyACM0 BAUD=921600 deploy +``` + +Notes: +- `PORT` can be omitted. The build script will try to auto-detect the ESP32 port. +- If multiple ESP32 devices are connected, the script will ask which one to flash. + +## Flash later (manual) + +If you build without `deploy`, the script prints an exact flash command at the end under: + +- `To flash firmware:` + +Run that printed command to flash later. + +## Common issue + +Do not use `--board-config` with GNU make. For this project, board presets are selected with `--toml=...`. + +## Troubleshooting (unstable / rolling image) + +If the picture looks unstable (for example text appears to "run through" the panel), this is usually RGB timing related. + +- This preset uses a conservative pixel clock (`freq = 10000000`) for better signal stability on ESP32-S3 RGB panels. +- This preset defaults to `pclk_active_low = false`. If your panel is still unstable, toggle `pclk_active_low` in `Gen4-ESP32-70CT.toml` (`true` <-> `false`) and rebuild. + +Rebuild command: + +```bash +python make.py esp32 clean BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT --toml=display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml INDEV=ft5x46 +``` diff --git a/display_configs/Gen4-ESP32-70CT/board.json b/display_configs/Gen4-ESP32-70CT/board.json new file mode 100644 index 00000000..8e6cb20f --- /dev/null +++ b/display_configs/Gen4-ESP32-70CT/board.json @@ -0,0 +1,6 @@ +{ + "mcu": "esp32s3", + "product": "gen4-ESP32-70CT (7\" 800x480 Capacitive Touch Display Module)", + "url": "https://4dsystems.com.au/products/gen4-esp32-70ct/", + "vendor": "4D Systems" +} diff --git a/flash_from_codevm.ps1 b/flash_from_codevm.ps1 new file mode 100644 index 00000000..525f0400 --- /dev/null +++ b/flash_from_codevm.ps1 @@ -0,0 +1,68 @@ +param( + [string]$BuildCommand = 'python3 make.py esp32 clean BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT --toml=display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml INDEV=ft5x46', + [switch]$SkipBuild = $true, + [switch]$SkipDownload = $false, + [switch]$SkipFlash = $false, + [switch]$SkipRepl = $false +) + +$ErrorActionPreference = 'Stop' + +$remoteHost = 'kmk0815@codevm' +$remoteProjectDir = '/home/kmk0815/work/micropython/lvgl_micropython' +$remoteFile = "${remoteHost}:$remoteProjectDir/build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin" +$localFile = Join-Path $PSScriptRoot 'lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin' +$flachPort = 'COM10' +$port = 'COM11' + +Write-Host "[1/4] Running remote build on codevm..." +if (-not $SkipBuild) { + $remoteBuildCmd = @( + "cd $remoteProjectDir", + $BuildCommand + ) -join ' && ' + ssh $remoteHost $remoteBuildCmd + if ($LASTEXITCODE -ne 0) { + throw "Remote build failed with exit code $LASTEXITCODE" + } +} else { + Write-Host "[1/4] Skipping remote build." +} + +Write-Host "[2/4] Downloading firmware via scp..." +if (-not $SkipDownload) { + scp $remoteFile $localFile + if ($LASTEXITCODE -ne 0) { + throw "scp failed with exit code $LASTEXITCODE" + } +} else { + Write-Host "[2/4] Skipping firmware download." +} + +if ((-not $SkipFlash) -and (-not (Test-Path $localFile))) { + throw "Firmware file not found after download: $localFile" +} + +Write-Host "[3/4] Flashing firmware with esptool..." +if (-not $SkipFlash) { + esptool --chip esp32s3 -p $flachPort -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m --erase-all 0x0 $localFile + if ($LASTEXITCODE -ne 0) { + throw "esptool failed with exit code $LASTEXITCODE" + } +} else { + Write-Host "[3/4] Skipping flashing." +} + +Write-Host "[4/4] Opening REPL via plink..." +if (-not $SkipRepl) { + try { + plink.exe -serial $port -sercfg 115200,8,n,1,N + if ($LASTEXITCODE -ne 0) { + Write-Warning "plink exited with code $LASTEXITCODE. Download and flash are already done." + } + } catch { + Write-Warning "plink returned an error. Download and flash are already done." + } +} else { + Write-Host "[4/4] Skipping REPL startup." +}