Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions display_configs/Gen4-ESP32-70CT/Gen4-ESP32-70CT.toml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to remove the touch calibration settings. These are going to be unique to your display. The other thing is typically a touch calibration will only need to be done when using a resistive touch display and the FT series of IC's are for capacitive type touch displays. It is very rare to need to do a calibration on this type of display IC.


[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=[]
57 changes: 57 additions & 0 deletions display_configs/Gen4-ESP32-70CT/README.md
Original file line number Diff line number Diff line change
@@ -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
```
6 changes: 6 additions & 0 deletions display_configs/Gen4-ESP32-70CT/board.json
Original file line number Diff line number Diff line change
@@ -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"
}
68 changes: 68 additions & 0 deletions flash_from_codevm.ps1
Original file line number Diff line number Diff line change
@@ -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'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add some kind of a check to ensure the user has WSL and if it is not installed output an error that states using WSL is required. I would also have a check done to make sure the WSL image that is being used in Ubuntu since Ubuntu is known to be compatible with the build system in lvgl_micropython.

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."
}