Skip to content

Flash at 120 MHz (needs the bootloader flashed once over serial) - #33

Merged
finger563 merged 1 commit into
mainfrom
perf/flash-120mhz
Nov 21, 2026
Merged

finger563 merged 1 commit into
mainfrom
perf/flash-120mhz

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Summary

The flash runs at 120 MHz instead of 80 MHz.

  • Code outside the cores' PSRAM overlay runs from flash, so a cache miss there costs a third less.
  • That code is the audio and video glue, FreeRTOS, the drivers and the parts of each core kept in flash.

The Tab5's flash is an XMC part (ID 0x464018). It enters its high-performance mode by changing the read dummy cycles, so it needs:

  • CONFIG_SPI_FLASH_HPM_ENA. ESP-IDF's DC mode for this chip turns on with it: SPI_FLASH_HPM_DC_ON.
  • CONFIG_BOOTLOADER_FLASH_DC_AWARE. Without it the chip may not boot after a reset.

Over-USB updates only replace the app, so the bootloader has to be flashed once over serial with idf.py flash; emulink reboot --bootloader puts the Tab5 in download mode without the BOOT button. The README says so.

Measurements (Tab5, the same code built for 80 and 120 MHz)

Game 80 MHz 120 MHz
Jedi Knight (menu) 15.20 ms/frame, 36.4 fps 12.56 ms/frame, 40.3 fps -17%
MSX 9.11 ms 8.71 ms -4%
Doom 10.08 ms 9.66 ms -4%
NES 6.69 ms 6.45 ms -4%
Genesis 11.57 ms 11.23 ms -3%
GBA 12.06 ms 11.86 ms -2%
SMS 8.82 ms 8.64 ms -2%
MGS 10.3 fps 10.6 fps +3%
SNES 27.9 fps 27.9 fps (core-bound, from PSRAM)

There is no RAM cost.

Testing

  • The 120 MHz bootloader and app were written over serial in download mode. The board booted and ran 13 games plus about 15 more launches across later builds, with no problems.
  • The defaults resolve to 120M, HPM_ENA, HPM_DC_ON and DC_AWARE (checked with idf.py reconfigure).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY

Code outside the cores' PSRAM overlay runs from flash (80 MHz QIO), so
each cache miss there now costs a third less. Measured on the Tab5 with
the same code at 80 and 120 MHz (game thread CPU per presented frame):
Jedi Knight -17% (36.4 -> 40.3 fps at the menu), MSX / Doom / NES -4%,
Genesis -3%, GBA -2%, SMS -2%, MGS +3% fps (10.3 -> 10.6), SNES
unchanged; no RAM cost.

The Tab5's flash (XMC, ID 0x464018) enters its high-performance mode by
changing the read dummy cycles: SPI_FLASH_HPM_ENA (ESP-IDF's DC mode for
it) and BOOTLOADER_FLASH_DC_AWARE, without which the chip may not boot
after a reset. Over-USB updates only replace the app, so the bootloader is
flashed once over serial (README).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
@finger563
finger563 merged commit 966913b into main Nov 21, 2026
1 check passed
@finger563
finger563 deleted the perf/flash-120mhz branch November 21, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant