espressif: add ESP32-C5 support and the ESP32-C5-DevKitC-1-N8R8 board - #11297
espressif: add ESP32-C5 support and the ESP32-C5-DevKitC-1-N8R8 board#11297mikeysklar wants to merge 4 commits into
Conversation
C5 is the first dual-band ESP32. It differs from c6 in ways that build cleanly but fail at run time: - bootloader flash offset is 0x2000, not 0x0 - ADC1 channels start at GPIO1, not GPIO0 - efuse MAC registers are named like c61, not c6 - libphy.a references _rom_eco_version, so rom.version.ld must link - USB-Serial-JTAG pads (GPIO13/14) are cleared by gpio_ll_func_sel(), so reset_all_pins() must skip them along with the flash/PSRAM MSPI pins and VDD_SPI - boot button is GPIO28, not GPIO9 or GPIO0 - the 48MHz crystal leaves only 40/80/160/240MHz CPU valid - TWAI is the newer TWAI-FD, so canio is off pending a backend
8MB flash, 8MB quad PSRAM, WS2812B on GPIO27, UART0 on GPIO11/12. Flash mode is dio: qio locks the CPU during bootloader startup on this board. PSRAM stays qio, which is the only mode C5 offers.
1e16f91 to
aa2c8db
Compare
|
zephyr-tests flaky: different tests fail each run. Re-run please? |
|
Does |
|
It is a The value is read when the radio starts, so toggling I can add another PR for dynamic band jumping between 2.4 and 5 GHz. Seems early to add that in, but if you think it is critical, sure. |
|
AUTO should be fine. I gave only a cursory look at the esp-idf docs, but it seems like AUTO would allow an AP, for example, to be started on a 2.4 GHz channel, then later stopped and a 5 GHz AP started. And similar for a station connection. Or even, later, for So I suppose the band selection would be mainly if someone wanted to limit the band use in their own locale. |
|
AUTO picks the strongest AP, so same-SSID networks land on 2.4 GHz. One room from my AP:
Three trials each. |
tannewt
left a comment
There was a problem hiding this comment.
Two small things. Good otherwise.
|
I think we should have a runtime API to select the band, with 2.4 as the default. If we have that, we don't need a I noticed you used strings. For API, I'd use a CircuitPython enum-style value like |
|
CIRCUITPY_WIFI_BAND isn't in this PR. Let's wait to discuss it when it is proposed as a PR. |
The comment was copied from the c6 block. The 8MB flash has a 2048K app partition, and enabling both leaves 42 KB free.
The C5 has an I2S peripheral and the DevKitC breaks out 19 GPIOs, so external I2S hardware works the same as on the S3 DevKitC, which ships with these on and has no onboard audio either. Costs 78160 bytes, leaving 42928 free in the 2048K app partition.
What
Adds ESP32-C5 target support and the ESP32-C5-DevKitC-1-N8R8 board.
Why
First dual-band ESP32. These C6 differences build clean but fail at runtime.
0x00x2000caniois offreset_all_pins()must also skip the MSPI and USB pins.No ESP-IDF bump: builds against the pointer already on
main.Hardware tested
2b900d1Version string is from the build tree; contents match this branch.
Not tested: deep sleep, Windows, macOS.
How I tested it
NeoPixel, BLE advertising and web workflow also verified.
Scope
This PR is board and target support only. 2.4 GHz works.
Off for this target, reasons in
mpconfigport.mk:canio,paralleldisplaybus,espcamera,espulp,memorymap,rgbmatrix,touch, DAC, PDM, SDMMC.
Follow-up PRs
Two more complete 5 GHz. Neither is board-specific, so both are separate.
common-hal/wifi/ScannedNetworks.c,shared-bindings/wifi/Radio.cCIRCUITPY_WIFI_BANDpins the radio to one bandcommon-hal/wifi/Radio.c,docs/environment.rstThe second stacks on the first. Both are verified on this board.
The first raises the
start_scanning_networks()defaultstop_channel, 11 to165. Every board would then also scan channels 12-14.
Say if you want that split out or dropped.
AI assistance
Claude Code wrote most of this diff. I ran every hardware test.