Repository navigation
x4prosim: USB-CDC host always looks plugged in - #3
Merged
Merged
Conversation
IDF's plug watchdog clears the SOF status bit in every FreeRTOS tick hook and declares the host gone after five hooks that found it clear; Arduino's HWCDC then routes writes through its 256-byte ring and a 52 KB screenshot over the serial-control protocol arrived as 256 bytes. QEMU can run several ticks within one virtual millisecond, so a SOF bit that only came from the 1 ms timer went missing often enough. The SOF status bit now always reads as set and the frame counter follows virtual time; the 1 kHz SOF interrupt stays. Unplugging isn't modeled. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T57W7AZf7tgmkuDMMSaWwz
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T57W7AZf7tgmkuDMMSaWwz
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Anything that attaches a host program to the USB-CDC console (CrossPoint's
debugging_monitor.py/device_control.pyover-chardev pty) got truncated writes from the guest: a 52 KBSCREENSHOTreply arrived as exactly 256 bytes. Nothing in the firmware is wrong; the USB Serial/JTAG model let IDF's plug watchdog decide the cable was out.Cause
IDF's
usb_serial_jtagplug watchdog clears the SOF status bit in every FreeRTOS tick hook and declares the host gone after five hooks that found it clear. The model only set that bit from its 1 ms SOF timer. Under-icountQEMU runs several ticks inside one virtual millisecond when timer deadlines bunch up, so the bit went missing often enough that Arduino's HWCDC marked the link down and routed writes through its 256-byte ring, dropping the rest.Change
hw/misc/esp32s3_usb_jtag.c(one file, shared by the S3 and C3 machines):INT_RAW/INT_STand is OR'd into the IRQ line. Unplugging isn't modeled; the model already assumed a host was present.FRAM_NUMfollows virtual time (qemu_clock_get_ms & 0x7ff) instead of the timer's own count, so the watchdog's frame-number comparison sees progress even when the main loop lags.X4PROSIM.mdgains a note on driving the console from a host script: give it a pty (-chardev pty,id=cdc, QEMU prints the path on stdout) and point the monitor at that path.Verified
CrossPoint develop plus the serial-device-control branch on
-machine x3, console on a pty, driven through the branch's own monitor anddevice_control.py:SCREENSHOT_ENDstill arrives, every capture fails the same way.Both
qemu-system-riscv32andqemu-system-xtensabuild; the X4 Pro path is the same file and the same bit, but I had no X4 image to re-run.🤖 Generated with Claude Code
https://claude.ai/code/session_01T57W7AZf7tgmkuDMMSaWwz