Skip to content

Add a Waveshare ESP32-P4-WIFI6-Touch-LCD-4.3 page and document scan_networks()'s empty-scan retry - #13

Merged
ThomasFarstrike merged 3 commits into
MicroPythonOS:mainfrom
bitcoin3us:docs/esp32-p4-board
Oct 28, 2026
Merged

ThomasFarstrike merged 3 commits into
MicroPythonOS:mainfrom
bitcoin3us:docs/esp32-p4-board

Conversation

@bitcoin3us

Copy link
Copy Markdown
Contributor

What

This PR covers the two docs follow-ups from closing MicroPythonOS/MicroPythonOS#309 (MicroPythonOS/MicroPythonOS#309 (comment)):

  1. A page for the ESP32-P4 board, with a note that its C6 firmware should be updated.
  2. The time_module argument of WifiService.scan_networks(). main already lists it in the signature and the parameters (61bf2ef, merged with WifiService: document None return values while WiFi is busy #12). This PR adds what it is for: the 5 s rescan from WifiService: scan again 5 s after an empty scan that follows a radio restart (#309) MicroPythonOS#341.

The board page

getting-started/waveshare-esp32-p4-wifi6-touch-lcd-4-3.md is new. The Waveshare ESP32-P4-WIFI6-Touch-LCD-4.3 is the first ESP32-P4 board (MicroPythonOS 0.20.0, MicroPythonOS/MicroPythonOS#308).

  • Chip revision. A bold line under the intro, and a section before anything else:
    • 0.20.0 runs only on ESP32-P4 chip revisions v0.x and v1.x. The esp32p4 image is built with ESP-IDF 5.5.1, which fixes the maximum at v1.99. main builds it the same way. The board it was developed on has v1.3.
    • v3.x is not supported. Waveshare's FAQ calls v0.x/v1.x chips engineering samples, and one user's board has a v3.2 chip. Espressif says v1.x and v3.x cannot share an image, and v3.x needs ESP-IDF 5.5.3 or later. ESP32-P4: support chip revision v3.x (needs a newer ESP-IDF and a second esp32p4 image) MicroPythonOS#344 tracks it.
    • How to read the revision: esptool chip_id prints Chip is ESP32-P4 (revision v1.3) in esptool v4, and a Chip type: line in v5. The page says that the "no chip ID" warning, and v5's note that chip_id is deprecated, are expected.
    • On a v3.x board: keep the factory firmware. Forcing the image makes the board reset in a loop. The v3.2 board did, with rst:0x10 (CHIP_LP_WDT_RESET), and started again once Waveshare's factory firmware was written back.
  • esptool's revision check (install step 2). The release .bin starts with 0x2000 bytes of padding, so esptool cannot read an image header from it and writes it to any revision. Files that do start with a header, such as the .ota file or a bootloader built separately, are checked. Up to esptool v5.4.0, esptool refuses every such file whose revision range excludes the chip. From v5.5.0 (espressif/esptool d2c62467), it refuses only a bootloader at 0x2000 and prints a note for the others. The step says this, and that --force does not help.
  • What works: display (800x480 landscape, rotated by the PPA), brightness, touch, speaker and Wi-Fi.
  • What doesn't: v3.x chips, microphones (the ES7210 is not set up on this board), the TF card slot, the camera, USB host and the battery level. Bluetooth is listed as not tested.
  • Installing with esptool: check the chip revision, back up the factory firmware (optional, with the restore command), then write the release image at offset 0, with --erase-all the first time.
  • Updating with OSUpdate. The update server has an entry for this board. 0.20.0 is its first release, so the page says this has not been tested on it yet. For the manual offline update in updating.md, it names the .ota file and the esp32p4 OTA slot offsets (0x20000, 0x420000).
  • The C6 firmware:
    • Why it should be updated. On the original firmware, a scan straight after a radio restart came back empty. The 5 s rescan from WifiService: scan again 5 s after an empty scan that follows a radio restart (#309) MicroPythonOS#341 is on main, not in 0.20.0, and it could not be tested on that firmware.
    • How to read both versions with hosted.host_version() and hosted.coprocessor_version().
    • MicroPythonOS has no supported way to update it. The page says so and points to Espressif's co-processor OTA example and Waveshare's FAQ.
  • Known issue, channels 6 to 9: the numbers from Board support: Waveshare ESP32-P4-WIFI6-Touch-LCD-4.3 (esp32p4 target, MIPI-DSI display, touch, speaker) MicroPythonOS#308. Channel 6 also fails with Waveshare's own example and with plain ESP-IDF, on the original and on the updated C6 firmware. Another user reported it on the 3.4C board ([Bug] ESP32-C6 cannot authenticate on 2.4 GHz channel 6 (also 7 and 9); channels 1, 5 and 11 work waveshareteam/ESP32-P4-WIFI6-Touch-LCD-4.3#7). The board gets a 30 s connect wait. The workaround is router channel 1 or 11.
  • Building from source (./scripts/build_mpos.sh esp32p4) and a short summary of the board file.

WifiService

frameworks/wifi-service.md:

  • scan_networks(): a paragraph on the retry. While WiFi is not connected, the scan restarts the radio first. If that scan finds no networks at all, it waits SCAN_RETRY_DELAY_S (5 s) and scans once more, without another restart. The busy flag is held for the extra time. There is no second scan while connected, or when the first scan finds networks. The paragraph names the board the wait was added for, whose C6 still ran its original firmware (older than ESP-Hosted 1.4.7 on the board tested). The time_module parameter now says it is used for that wait.
  • After that paragraph, one sentence: release 0.20.0 does not have this retry or the time_module argument. On 0.20.0, scan_networks() takes only network_module.
  • connect(): its scan restarts the radio and retries the same way. It does not take the busy flag itself; auto_connect() holds it around the call.
  • The settings-screen example calls scan_networks() and attempt_connecting() from click handlers. A note under it says the screen does not respond until they return. While WiFi is not connected, scan_networks() takes at least 5 s longer if the first scan after the radio restart finds nothing. attempt_connecting() waits up to CONNECT_TIMEOUT_S. The note points to a background thread with update_ui_threadsafe_if_foreground(), as the built-in WiFi app does.
  • Desktop Mode table: the mock scan takes 1 s and ignores time_module.
  • The retry paragraph links to the board page's C6 section, and the board page links back to scan_networks().

Where the page is linked

  • mkdocs.yml: Getting Started, after Supported Hardware ("Waveshare ESP32-P4 4.3-inch").
  • getting-started/supported-hardware.md: a new "ESP32-P4 Microcontrollers" section. It says the board is supported on chip revisions v0.x and v1.x (tested on v1.3), not v3.x, and lists the parts that are not supported.
  • getting-started/index.md: one line.

Commits

Three commits on main (28cfda9):

  1. The board page, and where it is linked.
  2. The WifiService changes, on top of WifiService: document None return values while WiFi is busy #12's text. Where both touch the same line, the time_module parameter, the line on main is kept and extended.
  3. The chip revision section and the esptool fix on the board page.

Sources

Not tested or observed by me, and worded that way on the page:

Formatting

The esptool commands inside the numbered install steps are indented code blocks, not fenced ones. mkdocs.yml has no pymdownx.superfences, and without it a fenced block inside a list item renders as inline code. The other code blocks on the page are fenced as usual.

One thing outside this repo

The web installer's ESP32-P4 option does not load:

  • Its radio button points to /manifests/esp32/MicroPythonOS_esp32p4_0.20.x.json, which returns 404.
  • The manifest is at /manifests/esp32p4/MicroPythonOS_esp32p4_0.20.x.json, which returns 200.

So the option's manifest path in MicroPythonOS/install's index.html looks wrong. I have only checked the path, not the installer flashing a P4. Until it is fixed, the page says the option fails to load and uses esptool. The chip revision limit applies to the installer too, as its manifest points to the same 0.20.0 image.

Not in this PR

Supported Hardware does not list the Waveshare ESP32-S3-Touch-LCD-1.54 or ESP32-S3-Touch-LCD-3.5 either, though both have board files on main. I left them out to keep this PR to one board.

Build

mkdocs build --strict passes. Its output is the same as on main (28cfda9): no warnings, and the same INFO lines about pages left out of the nav and old relative links. In the built page, all six code blocks render as blocks, the install steps stay one numbered list, and the in-page links and the links between the two pages resolve.

🤖 Generated with Claude Code

With thanks to the scientists and engineers who did the hard, unglamorous work that got us here.

bitcoin3us and others added 3 commits October 26, 2026 15:39
The first ESP32-P4 board (MicroPythonOS 0.20.0, MicroPythonOS/MicroPythonOS#308)
gets its own page: what works and what doesn't, installing with esptool,
updating, the ESP32-C6 co-processor firmware, the channel 6-9 Wi-Fi
issue and building from source.

The page says early that only ESP32-P4 chip revisions v0.x and v1.x
are supported. The esp32p4 image (0.20.0 and main) is built with ESP-IDF
5.5.1, whose ESP32-P4 maximum revision is fixed at v1.99, so the image
does not start on a v3.x chip. esptool does not check this when it
writes the full image, so the install steps check the revision before
anything is erased.

The C6 section is the note Thomas asked for when closing
MicroPythonOS/MicroPythonOS#309: the C6 firmware should be updated. It
says why (empty scans straight after a radio restart on the original
firmware; the 5 s rescan from MicroPythonOS/MicroPythonOS#341 is on
main, not in 0.20.0), how to read both ESP-Hosted versions with the
hosted module, and that MicroPythonOS has no supported update path,
pointing to Espressif's co-processor OTA example and Waveshare's FAQ
instead.

The commands inside the numbered install steps are indented code
blocks: mkdocs.yml has no superfences, so fenced blocks inside list
items would render as inline code.

The page is listed in the nav after Supported Hardware, in the Getting
Started overview, and in a new ESP32-P4 section of Supported Hardware.
That entry says the board runs on chip revisions v0.x and v1.x (tested
on v1.3), not v3.x, and lists the parts that are not supported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MicroPythonOS/MicroPythonOS#341 (merged 2026-10-21) gave
scan_networks() an optional time_module argument. When WiFi is not
connected, _scan_networks_raw() restarts the radio before it scans; if
that first scan returns no networks at all, it now waits
SCAN_RETRY_DELAY_S (5 s) and scans once more, without another restart.
scan_networks() and connect() both go through it.

main already lists time_module in scan_networks()'s signature and
parameters (61bf2ef, merged with MicroPythonOS#12). This adds what
it is used for: a paragraph on the retry, including that
scan_networks() holds the busy flag for the extra time, and "used for
the 5 s wait" on the time_module parameter. The paragraph names the
board the wait was added for, the Waveshare
ESP32-P4-WIFI6-Touch-LCD-4.3, whose ESP32-C6 still ran its original
firmware, and links to the C6 section of that board's page. A sentence
after it says that release 0.20.0 has neither the retry nor the
time_module argument.

connect() gets two sentences: its scan restarts the radio and retries
the same way, but connect() does not take the busy flag itself;
auto_connect() holds it around the call. Its arguments did not change.

The settings-screen example calls scan_networks() and
attempt_connecting() from click handlers. A note under it says the
screen doesn't respond until they return. While WiFi is not connected,
scan_networks() takes at least 5 s longer if the first scan after the
radio restart finds nothing. attempt_connecting() waits up to
CONNECT_TIMEOUT_S (13 s by default, 30 s on the Waveshare P4). The note
points to a background thread with update_ui_threadsafe_if_foreground(),
as the built-in WiFi app does.

The Desktop Mode table now says the mock scan takes 1 s and ignores
time_module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Waveshare ESP32-P4-WIFI6-Touch-LCD-4.3 page gets a Chip revision
section near the top, and a bold line under the intro that points to it.
It says that 0.20.0's esp32p4 image (ESP-IDF 5.5.1) runs only on chip
revisions v0.x and v1.x, and that main builds it the same way. Boards
with a v3.x chip, such as one user's v3.2 board, are not supported;
MicroPythonOS/MicroPythonOS#344 tracks it.

The section shows how to read the revision with esptool (the "Chip is"
line in esptool v4, "Chip type:" in v5). It says that the warning about
the ESP32-P4 having no chip ID, and esptool v5's note that chip_id is
deprecated, are expected. It says to keep the factory firmware on a v3.x
board, and that forcing the image makes the board reset in a loop. That
user's v3.2 board did, with rst:0x10 (CHIP_LP_WDT_RESET), and started
again after Waveshare's factory firmware was written back.

Install step 2 used to say only that esptool does not check the
revision. That holds for the release .bin: it starts with 0x2000 bytes
of padding, so esptool cannot read an image header from it, in any
version. But esptool does check files that start with a header, such as
the .ota file or a separately built bootloader. Up to v5.4.0 it refuses
any of them built for other revisions. From v5.5.0 (espressif/esptool
d2c62467) it refuses only a bootloader at 0x2000 and prints a note for
the others. Step 2 now says which files esptool refuses, and that
--force does not help. The step uses chip_id instead of flash_id.

The "What works" row links to the new section. The C6 section's #309
and #341 links are written in full, and the #341 bullet links to
scan_networks() in the WifiService docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants