Repository navigation
Conversation
software/wifi/tests: the handler of my_uart.c (raw_u64, raw_c3, u64ctrl) is cut out of each module as it is and run against a modelled UART and the real buffer queues of software/io/uart/cmd_buffer.c. No hardware, no ESP-IDF; `make isr`. A fix adds its own isr_<fix>_test.cpp and its models to the Makefile (`make isr-red`). First cases: a frame is delivered whole, escapes are decoded, a frame in pieces is delivered once, a queued frame goes out at the TX interrupt. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GideonZ#1041 (wifi-fixes) adds its own software/wifi/tests; the two trees would collide on Makefile and stub/. Nothing else changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two fixes edited the same lines of the Makefile; each now adds a file, and the Makefile includes isr_*.mk. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The CI step "make host_tests" runs the other host suites; this one is added to it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…per TX interrupt On a C64U the module kept 11 replies queued and released one per frame it received. The TX path started a frame only from the TXFIFO_EMPTY interrupt, which did not come when it was enabled with the FIFO already below its threshold (the reset value 96: the 10 in my_uart_init is applied only if the interrupt is in the enable mask, which it is not), and the handler's own enable raised nothing. Replies queued within one interrupt latency merged into one kick: one frame went out, the rest waited for the next kick, that is the next reply, a constant lag. (The edge-like behaviour is what the C64U showed; the IDF headers document a level behaviour. The host model is fitted to that evidence, not measured.) my_uart_tx_fill() sends as many queued frames as the FIFO has room for and says whether any is left. The TX interrupt and my_uart_transmit_packet both call it under the UART's lock, and the interrupt is enabled only for what did not fit (it then comes on the drain across the threshold). Bounded to one FIFO; no printf, no allocation. The same my_uart.c is in raw_u64, raw_c3 and u64ctrl; all three change. Host tests (software/wifi/tests, `make isr`): a 128-byte TX FIFO and an edge-like TXFIFO_EMPTY model; a burst of 11 replies leaves 10 queued on the parent and all sent here; four models of the code before the fix (`make isr-red`). The module identity is bumped as a placeholder; the maintainers assign the number at merge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GideonZ#1041 (wifi-fixes) adds its own software/wifi/tests; the two trees would collide on Makefile and stub/. Nothing else changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two fixes edited the same lines of the Makefile; each now adds a file, and the Makefile includes isr_*.mk. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…T tests in make host_tests The module identity is bumped as a placeholder so the updater installs the new build; the maintainers assign the final number at merge. The UART interrupt handler tests are added to the make host_tests run. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e next frame An overflow of the UART RX FIFO loses bytes at an unknown place in the stream. The handler had code for it (reset the FIFO) but RXFIFO_OVF was not in the enable mask of my_uart_init, so it never ran, and it came after the receive code anyway: the frame in progress carried on with whatever arrived next. It was delivered cut short, or glued to the next frame when its closing 0xC0 was lost, or the rest of a frame was taken for a frame, and the dispatcher ran a command nobody sent. Enable RXFIFO_OVF and handle it first in the pass: the FIFO is emptied and not read, the open frame is thrown away, and everything up to the next 0xC0 is skipped (it ends the damaged frame or starts the next). With no frame open there is nothing to skip. Seen on a C64U with the module's RTS flow control forced off for a hold under load: frames that began in the middle of an echo payload were answered as commands, and the link was dead afterwards. With flow control on, this needs a sender overrunning RTS (the margin is 6 characters); the same my_uart.c is in raw_u64, raw_c3 and u64ctrl, all three change. Host tests (software/wifi/tests, `make isr`): 5 cases, RED on this file's parent, plus five models of the code before the fix (`make isr-red`). The module identity is bumped as a placeholder; the maintainers assign the number at merge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GideonZ#1041 (wifi-fixes) adds its own software/wifi/tests; the two trees would collide on Makefile and stub/. Nothing else changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two fixes edited the same lines of the Makefile; each now adds a file, and the Makefile includes isr_*.mk. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…er does (raw status in the RX branch) The first version enabled the RXFIFO_OVF interrupt and handled it at the top of the pass. The mechanism that ran on hardware (a C64U, an RX overflow forced by switching the module's RTS flow control off for a hold under load: the module stayed alive, rx_fifo_ovf counted 1) keeps the interrupt disabled and looks at the raw status inside the RX branch, at the interrupt the full FIFO brings. This takes that mechanism, so the hardware result applies to what is merged: same detection point, same actions (the FIFO emptied and not read, the open frame thrown away, skip to the next 0xC0). The enable mask is as on master; the dead overflow branch at the end of the pass is as on master. Only the bench's counter is left out (master has no link counters). Host harness: the stub offers the raw status (uart_hal_get_intraw_mask); the cases are the same and still fail on master; the models of the old handler follow the new detection (isr_ovf.mk). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The CI step "make host_tests" runs the other host suites; this one is added to it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eonZ#1077) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…1078) Brings in GideonZ#1077 (updated onto master). Module IDENT renumbered after master: raw_u64 1.19, raw_c3 1.12, u64ctrl 1.30. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Brings in GideonZ#1078 and GideonZ#1077 (updated onto master). Module IDENT renumbered after master and GideonZ#1078: raw_u64 1.20, raw_c3 1.13, u64ctrl 1.31. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…u64 1.23, raw_c3 1.15, u64ctrl 1.33 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…dule identity raw_u64 1.24, raw_c3 1.16, u64ctrl 1.34 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@JC-000 thanks. I re-reviewed this PR at head 8e9182b. It goes in after #1078. Code review. The TX threshold claim checks out in source. In Host red/green at head.
Hardware. The description calls the model "fitted to evidence", so I want a measurement on master + this PR, not only the model. On the Ultimate 64 Elite (flashed) and the U2+L (CI build) I plan to compare the reply backlog and throughput before and after. If you have the bench counter that showed 11 replies queued, please share it as a patch; it stays out of this PR. As on #1078, our C64 Ultimate is not available for module flashing. |
|
@JC-000 to save you some time, I'm happy to write the bench counter for the reply backlog and run the measurement on our devices, including the C64 Ultimate, which can now take module builds. I'll post the patch and the numbers here, and none of it will be added to this PR. This goes in after #1078. If you already have the counter on a branch, a pointer is welcome and I'll use yours. |
|
Thanks. We have the counter on a branch: a bench-only command that records the deepest transmit queue, the backlog left, the drain time and the frame count for a burst of N queued frames, so backlog and throughput can be compared before and after. It applies to master, to #1078 and to this PR's head, builds for all three modules and passes host tests. It has not run on hardware yet; that happens on our Elite today, and I'll post the branch link with the results afterwards. If you'd rather not wait, go ahead with your own. Written with Claude Sonnet 5.5 and Claude Opus 5.5 in Claude Code. |
|
@JC-000 thanks, I'll wait for your counter branch and numbers. If you'd like the same measurement on our C64 Ultimate or U2+L afterwards, just say. |
|
The counter branch is up: https://github.com/JC-000/1541ultimate/tree/d59f892a62cc334d75cc92005c9ca963a9ca9619/bench-repro/1079-reply-backlog (branch Measured on our Ultimate 64 Elite with a module that already has the TX fill, so these are "after" numbers only:
667 KB/s is the 6.67 Mbaud UART limit. We have no module without the TX fill on the bench, so the "before" run on master + #1078 is the one we haven't done. If you have the time, running it on your C64 Ultimate or U2+L would give the first before/after pair. Written with Claude Sonnet 5.5 and Claude Opus 5.5 in Claude Code. |
|
@JC-000 here is the C64 Ultimate before/after with your counter branch. Setup. C64 Ultimate (XC7A50T), wired, WiFi connected. Both builds were flashed through the updater, and the module was installed in both cases:
The bench modules report version 1.0 at run time, so that a normal updater replaces them afterwards. Nothing else differs from your branch. Each cell is one run of
Result. On this C64 Ultimate, master + #1078 does not show the stall: The board is back on its normal firmware and module. |
|
Thanks for the C64 Ultimate run. On our Ultimate 64 Elite the idle bursts match yours: no stall before or after, with #1079 draining 11 × 4 B about 80 µs sooner (about 320 µs before, 240 µs after) and the large bursts at the UART limit on both builds. The difference shows under load. With six 1472-byte ICMP streams running:
Both builds run out of the 11 TX buffers under that load. What #1079 changes is that queued frames keep moving. Same counter branch as yours; both builds were flashed through the updater. Written with Claude Sonnet 5.5 and Claude Opus 5.5 in Claude Code. |
Fixes #1074
Problem
On a C64 Ultimate the module kept 11 replies queued and released one per frame it received. The TX path started a frame only from the TXFIFO_EMPTY interrupt, which did not come when it was enabled with the FIFO already below its threshold, and the handler's own enable raised nothing. Replies queued within one interrupt latency merged into one kick: one frame went out, the rest waited for the next kick, that is the next reply, a constant lag.
What changed and why
my_uart_tx_fill()sends as many queued frames as the FIFO has room for and says whether any is left. The TX interrupt andmy_uart_transmit_packetboth call it under the UART lock, and the interrupt is enabled only for what did not fit. Bounded to one FIFO; no printf, no allocation. Samemy_uart.cin raw_u64, raw_c3 and u64ctrl.This branch contains the RX-overflow PR (#1078), which contains the UART interrupt handler tests PR (#1077, the harness). They merge in that order.
Products. the ESP32 WiFi modules: raw_u64 (Ultimate 64 / Ultimate 64 Elite), raw_c3 (Ultimate-II+L) and u64ctrl (Ultimate 64 Elite II / C64 Ultimate); the same
my_uart.cis in all three. Tested on the C64 Ultimate.How I tested it
Host: macOS, with the device-free tests run in an Ubuntu 24.04 container (g++ 13.3). The hardware runs used the test harness from the same machine.
Host tests (device-free, run before and after the change):
make -C software/wifi/uart_tests isr; make -C software/wifi/uart_tests isr-redHardware.
On the C64 Ultimate: on an image without the fix, a reply held behind a filled TX FIFO was never sent — the Ultimate saw no reply from the module. With the fix the queued reply is sent: the module answers each round, with no "no reply" and 0% ping loss.
Standard profile / soak: not reported here — this change is module-side (ESP32) firmware, which the host-driven
./run-testsstandard profile and soak suites do not exercise. The module build is flashed and checked on its own (see above).Untested
Written with Claude Opus 5.5 in Claude Code.