Skip to content

HIL: ch32v307v_r1_1v0-usbhs net_lwip_webserver HTTP connect times out #4477

Open

Description

@hathach

ch32v307v_r1_1v0-usbhs fails device/net_lwip_webserver in HIL: the USB network interface enumerates and moves into the test namespace, then the first HTTP connect to 192.168.7.1 times out. The -usbfs variant of the same board passes.

Evidence

  • Found while Fix and re-enable network HIL testing #3918 re-enabled the network HIL test; it failed the same way on both heads CI ran there:
    • aaec618 (acceptance key 890c0aa0298479f2)
    • f51f4d4, run 42781105522, job 129712950178 (key da6e90223b5dfe68)
  • f51f4d4 row:
    ch32v307v_r1_1v0-usbhs  device/net_lwip_webserver  Failed: USB network test failed (rc=1): USB serial DE6B3E263B3857CAFFFFFFFF: interface usb1 (ifindex 118) at 19-1.7
    ... net_test.py check_http: TimeoutError: timed out
    
  • Same job, same board: ch32v307v_r1_1v0-usbfs device/net_lwip_webserver OK ... interface enx0202846a9600 (ifindex 123) at 19-1.4 | HTTP: 6 responses verified, 7425 bytes | iperf: 3.7 Mbit/s host to device.
  • The interface move and addressing succeed (hil_root netns), so the harness side is the same as for the passing boards; the data path on the CH32V307 USBHS port (dcd_ch32_usbhs with NCM) is the suspect.

Remaining work

  • Reproduce on ci.lan under a board hold: flash the usbhs build, check for ARP/ICMP from 192.168.7.2 in the namespace, usbmon on the bulk endpoints.
  • Find whether OUT NTBs reach lwIP or IN frames never leave the device; fix and drop the CI acceptance.

Not diagnosed in #3918: the PR changed only the test harness, and the failure was accepted there to land it.

Activity

  1. HiFiPhile commented on Nov 12, 2026

    @HiFiPhile
    Collaborator

    I tried to reproduce this away from ci.lan. Nothing outside it fails, so the cause is probably the CI board or the rig.

    #4493 fixes a different bug

    Linux host: the V305 passes

    I ran the same V305 on the tusb rig with Linux cdc_ncm, the interface in its own netns at 192.168.7.2 as net_test.py sets it up. Ping works, and HTTP returns all 7425 B of the asset set over 3 rounds. That holds with and without #4493. Linux never suspended the device while the interface was open (runtime_suspended_time=0), so the suspend bug can't be the cause on ci.lan either.

    DMA address range: probably not the cause

    ch32v307v_r1_1v0 links with 64K RAM and nanoch32v305 with 32K. I compared the two net_lwip_webserver builds (MinSizeRel), and every buffer USBHS DMA uses sits at the same address on both:

    symbol address
    ncm_epbuf (NTB OUT/IN and notification) 0x20004c90 (0x1810 B)
    ep0_buffer 0x20006568
    end of .bss 0x20006860

    Only _estack moves (0x20010000 vs 0x20008000). No USB transfer comes from the stack: NCM uses only ncm_epbuf and NULL for ZLPs, and EP0 always copies through ep0_buffer. So a DMA range limit above 32K wouldn't touch this example. These are local builds. I couldn't get the CI artifact, because the API returned 502.

    What's left

    What differs from my setup:

    • the CH32V307 board itself (clock, PHY, option-byte RAM split);
    • the ci.lan host and hub (19-1.7);
    • usb1 naming: the failing interface stays usb1, while the passing usbfs one is renamed to enx…. Possibly only timing.

    With a hold on the ci.lan board, the next checks are:

    1. tcpdump -i usb1 in the namespace during check_http: does an ARP reply ever come back?
    2. usbmon on the bulk endpoints: do OUT NTBs get ACKed, and does any IN NTB return?
    3. On the target over WCH-Link with gdb: _usbd_dev.suspended, ncm_interface.xmit_sequence and lwip_stats. These separate "OUT never reaches lwIP" from "IN never leaves the device".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Prio 📌follow-upDeferred work from a PR or investigation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions