summaryrefslogtreecommitdiff
path: root/hw/bsp
AgeCommit message (Collapse)Author
2026-07-24address #3787 Codex round 2: board-gate PHY resets, session robustnesshathach
The board-specific PHY-reset nets move behind a board.h opt-in (TRACE_ETM_QUIET_ENET_PHY on same70_xplained and mimxrt1170_evkb) so other boards of those families cannot inherit a foreign GPIO write; the chip-level trace pin muxes stay family-wide by design (same pattern as stm32h7). same70 reference: width 1 is the validated default until the J403.16 rework, and the hooks now wait (bounded) for PCKRDY3 before Ozone arms trace. ra8m1 reference caches the boot ROM in AfterTargetConnect so --attach sessions decode ROM execution too. etm_capture rejects an unexpanded CMake JLINK_DEVICE with a clear error; PIO-USB + TRACE_ETM on RP2350 is now a compile error (48 MHz trace clock is too slow for PIO-USB and a runtime switch would desync the stream); etm_profile keeps same-named statics from different modules as distinct rows. Build-verified: same70_xplained, mimxrt1170_evkb, raspberry_pi_pico2.
2026-07-24address #3787 reviews: bsp fixes, script hardening, board-note accuracyhathach
Bot findings (Copilot/Codex): no-op board_trace_pinmux stubs for lpcxpresso18s37/43s67 (TRACE_ETM otherwise broke their build), SAME70 ID_PIOD clock enable, capture-script duplicate BeforeTargetConnect on the RA references, profile-script support for --no-timestamps itraces. Deep review (whole branch): same70_xplained board row + caveat restored, stale pico2 72 MHz claim corrected to the shipped 48, explicit SetTracePortWidth(4) in the three references that relied on Ozone's default, coverage-cell guard, median-based SysTick calibration, dead session flag removed, stale RA8M1 divider comment fixed (0x02 = /4 is the validated chip max) and the debugger guard indented. EVKB bench findings: only R1884/D3 remains open (D1/D2 meter-verified); RT1176 trace width is 1 or 4 only - J-Link arms the CSSYS TPIU and its own sampler at 4-bit for any width>=2 request; a powered MCU-Link USB breaks the external probe even with JP4 shorted.
2026-07-24imxrt: hold EVKB Ethernet PHY in reset while tracing, 50 MHz trace pinhathach
Fresh bring-up pass on mimxrt1170_evkb: holding the 100M RTL8201 in reset (ENET_RST_B = GPIO_LPSR_04) stops its RMII lines driving against the shared trace pads and doubles the clean trace-pin rate to 50 MHz (100 MHz CSTRACE root; 133 MHz root is marginal, stock 132 corrupts). Validated 3x 8 s TinyUSB captures at 11.46M fetches. D1-D3 remain silent in every configuration - the welded R1882-R1884 are electrically open; reflow is the remaining step to width 4. Board notes gain JP4 (must be shorted for an external probe on J58).
2026-07-24same7x: ETM trace support for same70_xplainedhathach
J403 (bottom-side Cortex Debug+ETM footprint, header required): TRACECLK=PD8 peripheral D, TRACED0-3=PD4-7 peripheral C. TRACE_ETM builds hold the KSZ8081 PHY in reset (PD4-7 are its RMII receive outputs and it drives against the trace stream), clock the TPIU from PCK3 (MCK/2) and mux the pins; the ozone reference starts PCK3 in the post-reset/download hooks - TPIU programming while PCK3 is stopped is silently lost. Width-1 validated at the stock 300 MHz core; width 4 blocked on a dead D1 line (suspect probe channel, h743eval crosscheck pending).
2026-07-24samd5x_e5x: ETM trace support for same54_xplainedhathach
The populated 20-pin Cortex Debug+ETM header carries 4-bit trace (TRACECLK=PC27, D0-3=PC28/PC26/PC25/PC24, mux H). TRACE_ETM builds mux the pins and enable GCLK channel 47 (GCLK_CM4_TRACE) from GCLK0 - without that gate the port stays silent with pins and TPIU armed. Chip-max 120 MHz core / 60 MHz TRACECLK validated (3x 280M-fetch captures).
2026-07-24rp2040: RP2350/pico2 ETM trace over fly-wired MIPI-20hathach
J-Link's built-in RP2350 script owns the whole chip-side path (component map is not ROM-table-discoverable; a custom JLinkScript replaces the built-in one and kills pin trace), re-arming at every resume - firmware does no trace setup. TRACE_ETM builds pin clk_sys to 48 MHz from crt0 (fly-wire seating-proof; the port is DDR at clk_sys/2 and the J-Trace PRO V2 cliff sits just above 40 MHz TRACECLK - SEGGER requires V3.0+ for this chip), clear TIMER0/1 DBGPAUSE (default freezes the us-timer while any core is debug-halted and sleep_ms spins forever), and run the UART console TX-only (GPIO1 = default UART0 RX = TRACECLK).
2026-07-24ra: TRACE_ETM for ra6m5_ek and ra8m1_ekhathach
Generic TRCKCR setup gated on DHCSR.C_DEBUGEN (a standalone-boot TRCKCR write wedges the chip un-attachable until power-cycle), two-step write per the hardware manual. ra6m5_ek: div-4 (25 MHz pin) - div-2 is dead on this board at every width/timing; J9 must be closed. ra8m1_ek: chip-max 120 MHz TRCLK / 60 MHz pin via the committed JLinkScript whose empty OnTraceStart defers the trace clock to firmware (J-Link's from-reset enable steps the clock mid-stream at the FSP MOCO-to-PLL switch); ReadIntoTraceCache covers runtime ROM execution. J9 closed on both EKs - open = SWD contention up to apparent bricks.
2026-07-24stm32n6: TRACE_ETM support and stm32n657nucleo referencehathach
M55 flashless RAM image: Development boot (JP2/BOOT1=1) REQUIRED - flash boot parks the chip un-attachable. 300 MHz core (TRACE_ETM selects IC1/4; 600 MHz kills the stream in the startup burst), 18.75 MHz TRACECLK (cpu/16) width 4; N6 trace components are ROM-table-discoverable, no J-Link script.
2026-07-24stm32h7rs: TRACE_ETM support and stm32h7s3nucleo referencehathach
300 MHz core, 50 MHz TRACECLK, width 2: SB11/SB12 stub TRACED2/3 onto Zio CN8 and kill width 4 under IRQ-heavy USB traffic (removal = width-4 TODO at 600 MHz). Session note: --attach while a host actively polls the device wedges its USB session.
2026-07-24imxrt: TRACE_ETM for RT1011 and RT1176, validate both boardshathach
metro_m7_1011 (custom ETM-header rework): 500 MHz core, 66 MHz TRACECLK width 4, +50 ps; trace_etm_init ungates the 132 MHz trace root that BOARD_BootClockRUN leaves gated. mimxrt1170_evkb: 996 MHz CM7 at width 1, CSTRACE pinned to 50 MHz (stock 132 corrupts - the Ethernet PHY loads the CLK net) and the CM7 platform trace-funnel port enabled in firmware: J-Link does not program that funnel and everything reads register-perfect yet silent without it. FlexSPI boot needs the committed SP/PC hooks; D1-D3 stay dead pending the R1882-R1884 continuity check (width-4 TODO).
2026-07-24stm32h5: TRACE_ETM support and stm32h563nucleo referencehathach
H5 hangs its debug AP if trace CoreSight is touched unclocked (recover = power-cycle): the reference's AfterTargetConnect clocks the DBGMCU trace domain but defers IOEN to firmware, or the mid-boot clock switch desyncs the decoder. Stock solder bridges make the CN5 path marginal: validated config is 100 MHz core, width 1, +5 ns (board.h selects the reduced clock for TRACE_ETM builds); width 4 / 250 MHz retest waits on SB removal.
2026-07-24nrf: etm-trace for nrf52840dk and nrf5340dkhathach
nrf52840dk: 16 MHz TRACECLK (hardware cap) width 4, P25 soldered, SW7=Alt; no family code needed (J-Link arms TRACECONFIG). nrf5340dk: TRACE_ETM builds force the TAD port to 16 MHz (SystemInit's 64 MHz is marginal), +3 ns sample timing; the interface MCU's UART1 flow control drives the trace pins - SB27/SB28 must be cut (P0.10/P0.11 = TRACEDATA1/0).
2026-07-24lpc43: prepare ea4357 trace pins (bring-up blocked on SJ1 rework)hathach
BSP mux + board.h are register-proven; the module routes TRACECLK to the header only with SJ1's 0-ohm resistor moved to pads 2-3 (Lauterbach doc confirms), so hardware validation waits on that rework.
2026-07-24lpc18: mcb1800 etm-trace - disable pull-ups on trace lineshathach
60 MHz TRACECLK (CCLK/2) width 4 with J5 DBG_EN fitted; board.h drops the trace-line pull-ups and the ozone reference points at the device example. A badly-mated ribbon reads register-perfect yet silent - re-seat first.
2026-07-24lpc40: validate ea4088_quickstart etm-trace referencehathach
120 MHz TRACECLK width 4 over the fully-wired J7 (rev B schematic, TRACE_5V on pin 11). FS enumeration finishes in <100 ms - ISR analysis needs a short no-eviction window (--duration-ms 150).
2026-07-24stm32h7: tune stm32h743eval ozone trace referencehathach
+100 ps sample timing at 400 MHz core / 50 MHz TRACECLK (PLL1R-fixed), width 4. Startup-burst overflow at 400 MHz is expected; board.h documents the PLLN reduction for overflow-free capture.
2026-07-24Merge pull request #3786 from hathach/claude/improve-debug-skill-agentHa Thach
docs(skills): debug-skill overhaul — role-neutral capture model, verified debugger arsenal, Espressif backend
2026-07-24fix(rp2040): make stdio_rtt_init statichathach
LOGGER=rtt builds of any rp2040 example fail with -Werror=missing-prototypes (stdio_rtt_init has no prototype and is only called from family.c). Found by building cdc_msc -DLOG=2 -DLOGGER=rtt for raspberry_pi_pico.
2026-07-21Add support for APM32F072Jie Feng
2026-07-19misc fixesJie Feng
2026-07-19makefile cleanupJie Feng
2026-07-19probably the right mcu targetJie Feng
2026-07-19examples now buildJie Feng
2026-07-19add py32f0 supportJie Feng
2026-07-19Merge pull request #3775 from hathach/claude/add-usb-debug-sniffHa Thach
usb-target-debug/usb-sniffer skills
2026-07-18fix(ci_fs): address code-review findings in host/device drivershathach
Host (hcd_ci_fs.c): - Release the speculatively-armed sibling BDT on the NAK path (IN only) as well as on completion, so a NAKed multi-packet IN no longer leaks a BDT that stays own=1 and blocks every same-direction pipe. Both paths now go through a single release_sibling_bd() helper (was a copy-pasted disarm). - Clear the ENTIRE shared BDT (both directions) on bus reset; clearing only the IN half left a stale OUT/SETUP descriptor after a disconnect mid-OUT, blocking the first control transfer on re-enumeration. - Size bda[] to span the whole BDT (2*2*4) so STAT-indexed access is within the declared array bounds (was out-of-declared-bounds, benign via union). Shared (ci_fs_type.h): - Hoist buffer_descriptor_t and the TOK_PID enum out of the device and host drivers into the shared header so the identical definitions cannot drift. Board (kinetis_k): - Drop a redundant local in board_get_unique_id. Build-verified: host + kinetis k/kl/k32l + MCX. HIL: frdm_k64f host 2/2 (cdc_msc_hid + device_info); frdm_kl25z device core suite green with the relocated definitions.
2026-07-17kinetis_k: non-blocking board_uart_read (RX FIFO) + SIM unique idhathach
- board_uart_read was a stub returning 0, so host examples that bridge the UART console to a CDC device (echo test) received nothing. Implement it via an RDRF-interrupt-fed tu_fifo, matching the stm32 family (non-blocking, no RX overrun). board_uart_write is already non-blocking. - implement board_get_unique_id() from the SIM 128-bit UID registers so frdm_k64f/teensy_35 report a real USB serial instead of the fixed default. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ExGPLP5eU43LR7o6yYLpNi
2026-07-17migrate NXP Kinetis khci to chipidea ci_fs driver (device + host)hathach
Complete the khci -> chipidea ci_fs migration that was started for device (commit d70403f1f "host is not yet"): - device: switch kinetis_k/kl/k32l (Makefiles + k32l CMake) to dcd_ci_fs.c - host: add hcd_ci_fs.c (port of hcd_khci.c onto ci_fs_regs_t) and switch all Kinetis families to it; remove src/portable/nxp/khci entirely - enable host examples (device_info, cdc_msc_hid) for mcu:KINETIS_K - README: merge the KL and K32L2 rows into a single "KL, K32L" ci_fs row hcd_ci_fs.c also fixes two pre-existing host bugs found via HIL on frdm_k64f (present in the old hcd_khci.c too): - data toggle was flipped on a NAK in suspend_transfer; a NAK transfers no data so the toggle must be preserved, else the retried bulk packet is silently discarded by the device (MSC CBW/CSW hang). See comment in file. - prepare_packets asserted and dropped a transfer when the single shared BDT was still owned by an in-flight transfer under concurrent activity; now it returns busy and resume_transfer defers/retries on the next SOF. HIL verified on frdm_k64f: device 13/13, host cdc_msc_hid (CDC mount + echo + MSC mount, through a hub). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ExGPLP5eU43LR7o6yYLpNi
2026-07-17lpc15, lpc40: board_get_unique_id via IAP ReadUIDhathach
Real 128-bit chip UID as the board serial (IAP cmd 58, status checked against IAP_CMD_SUCCESS), replacing the shared placeholder — required for HIL board identification by serial. lpc40's lpcopen Chip_IAP_ReadUID() returns only the first UID word, hence the direct iap_entry() call. Verified on ea4088_quickstart and lpcxpresso1549: both enumerate with their chip UID and are selected by it in the HIL configs.
2026-07-15bsp/stm32h5: add missing IAR linker script for stm32h533hathach
stm32h533nucleo could never link with IAR: family.cmake points LD_FILE_IAR at linker/stm32h533xx_flash.icf, which did not exist (every sibling H5 variant has one). Surfaced by CircleCI's one-random job picking stm32h533nucleo+IAR (Fatal error[Lc002]). H533 and H523 have identical memory maps (512K flash / 272K RAM; their GCC .ld files differ only in a comment), so the icf is a copy of the H523 one.
2026-07-13rusb2: EP0 OUT reliability, HS UTMI PHY power-up, FS-only build supporthathach
- EP0 OUT: park a back-to-back data-stage packet the DCP accepted before PID could go NAK and deliver it into the next armed chunk; flow-control the single-buffer control pipe between chunks (usbtest ctrl_out corruption); discard a packet parked while an OUT pipe was halted so BOT reset recovery's fresh CBW read can't receive stale WRITE data - HS UTMI PHY power-up per the FSP sequence, shared by dcd/hcd: CLKSEL programmed from the board XTAL (EK-RA8M1 runs 20 MHz; the 24 MHz reset default never locks) while DIRPD holds the PHY down, then timed release - hw/bsp(ra8m1_ek): fix U60CK divider macro - BSP_CFG_U60CK_DIV used the generic USB_CLOCK_DIV_8 encoding (7), which USB60CKDIVCR rejects, leaving the USBHS link domain at 480 MHz; the USB60-specific BSP_CLOCKS_USB60_CLOCK_DIV_8 (4) sticks and yields the required 60 MHz from PLL1P - support FS-only builds on the high-speed port: gate SYSCFG.HSE on TUD_OPT_HIGH_SPEED (RHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED was a silent no-op) and always compile both hwfifo access widths - the FIFO width belongs to the module, not the link speed (FS builds corrupted odd-length tails: 16-bit access against MBW-32) - iso activate: reset stale pipe bookkeeping so a BRDY firing before the class re-arms can't replay a pre-SET_INTERFACE transfer; write PIPEBUF after PIPESEL selects the pipe (PIPESEL-windowed register) - clear-halt: re-assert BUF on a still-armed OUT pipe (usbtest case 29) - bound the D0FIFO ready spin so an undrained double-buffered IN pipe can't freeze the stack with the IRQ masked - usbtest example: cap interrupt mps at 64 on RUSB2 high speed (pipes 6-9 have a fixed 64-byte buffer, RA6M5 UM 29.1) Verified: usbtest 30/30 on ra6m5_ek (HS), ra4m1_ek (FS) and ra8m1_ek (FS-forced build on the HS port). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-09bsp(ch32): naked fsdev ISRs so nested USBD IRQs return safelyhathach
The three USBD lines nest under QingKe HWSTK; gcc's interrupt prologue corrupts the return, so rely on the hardware stack and bare mret. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-06-27bsp/stm32h5: fix linkerHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-06-27bsp/stm32h5: fix uart definitionHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-06-27refresh presetsHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-06-26Added NUCLEO_H533RE so this board can be used out-of-the-boxgrunzasr
2026-06-26Added files by copying and modifying files from stm32h503nucleo direcotry to ↵Steven Grunza
stm32h533nucleo
2026-06-24typec: add stm32u5 supportHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-06-22Merge remote-tracking branch 'origin/master' into add-ch58x-usbfshathach
2026-06-22hw/bsp+wch: rename the CH58x family to ch583 and OPT_MCU_CH58X to OPT_MCU_CH583hathach
The BSP family and MCU option were named "ch58x"/"CH58X", but the supported part is the CH583/CH582 (and the SDK repo is openwch/ch583); CH585 is a separate MCU family, so the CH58x umbrella was misleading. Rename to the specific family: - hw/bsp/ch58x -> hw/bsp/ch583 (dir), and the BSP-local files ch58x_it.* -> ch583_it.*, system_ch58x.* -> system_ch583.* (include guards/refs updated). The vendor SDK files (CH58x_common.h, CH58x_*.c in hw/mcu/wch/ch583) keep their names. - OPT_MCU_CH58X -> OPT_MCU_CH583 in tusb_option.h, tusb_mcu.h, and the shared WCH USBFS driver (ch32_usbfs_reg.h, dcd_ch32_usbfs.c). OPT_MCU_CH582 is kept as an alias (same value), so either name selects the same code. - FAMILY_MCUS CH58X -> CH583, CFG_TUSB_MCU=OPT_MCU_CH583, mcu:CH58X -> mcu:CH583 in the example skip lists, the CI build matrix (ci_set_matrix.py), the get_deps family tag, and docs/reference/boards.rst. Board names (ch582m_evt, yd-ch582m) are unchanged. Verified: make + cmake build for ch582m_evt, and ci.lan HIL (all device examples pass). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-20hw/bsp/ch58x: address review feedback and read the real chip unique idhathach
Fold in the CH58x BSP review fixes: - family.mk: drop stray trailing backslashes on the last LDFLAGS/SRC_C entries (harmless -- GNU Make ends the list at the blank line -- but misleading). - debug_uart.c: uart_write() spun on a full ring buffer with nothing to drain it (only uart_sync() advances tx_consume), so a burst larger than the buffer deadlocked. Drain the FIFO while waiting, like uart_sync() does. - wch-riscv.cfg: move the OpenOCD work area from 0x80000000 (unmapped) to the 0x20000000 SRAM, sized to 32 KB, matching ch32v20x/wch-riscv.cfg. - family.c: implement board_get_unique_id() from the factory MAC. CH58x is a BLE part, so a unique 6-byte MAC lives in FlashROM at ROM_CFG_MAC_ADDR; GetMACAddress() reads it via FLASH_EEPROM_CMD (in libISP583.a), so no extra source file is needed. The read buffer is TU_ATTR_ALIGNED(4) and 8 bytes, per the SDK's documented 4-byte-aligned, word-granular buffer contract (CH58x_flash.c). - test/hil/tinyusb.json: key ch582m_evt off this board's actual MAC (D443627B5450) instead of the fixed placeholder, like every other board. Verified on ci.lan HIL: ch582m_evt enumerates with serial D443627B5450 and all device examples pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-20hw/bsp/ch58x: put linker flags in LDFLAGS so the make build linkshathach
family.mk listed -nostartfiles and the nano/nosys specs under LDFLAGS_GCC, a variable the make build system never reads (only LDFLAGS / LDFLAGS_CLANG are consumed by gcc_rules.mk). So the make build linked the toolchain's crt0.o alongside the SDK's startup_CH583.S and failed with "multiple definition of _start" + an undefined __bss_start, and also pulled in full newlib (RAM blew up). Rename it to LDFLAGS, matching ch32v20x/family.mk. The cmake build was unaffected (it sets these via target_link_options). Fixes the CircleCI one-random-make-ch58x build. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-20hw/mcu/wch: rename ch58x SDK dir to ch583 to match the openwch repohathach
The dependency is fetched from https://github.com/openwch/ch583.git but lived at hw/mcu/wch/ch58x. Rename the local path to hw/mcu/wch/ch583 so it matches the upstream repo name. Updates the get_deps.py path key and the ch58x BSP SDK_DIR (family.mk + family.cmake); the BSP family stays "ch58x" (covers CH582 and CH583). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-18Merge pull request #3701 from hathach/claude/issue-3696-20260612-0344Ha Thach
fix(stm32_fsdev): don't enable the unused USB wakeup EXTI IRQ (F1/F3/G4/L1)
2026-06-18fix(stm32_fsdev): don't enable the unused USB wakeup EXTI IRQ (F1/F3/G4/L1)hathach
The classic-USB STM32 fsdev driver enabled the EXTI-line USB wakeup interrupt (USBWakeUp_IRQn, and USBWakeUp_RMP_IRQn on the F3 remap path) in the NVIC, but never uses it: resume is serviced in-band via ISTR.WKUP in the USB_LP/HP ISR, and the driver never arms or clears that EXTI line. The wakeup EXTI interrupt is only needed to wake the core from STOP mode, which TinyUSB does not implement. Leaving its NVIC vector enabled lets it fire spuriously into an unhandled or looping vector -- the freeze reported in #3696 on STM32G473. USBWakeUp_IRQn is a valid, dedicated USB-wakeup-via-EXTI interrupt (e.g. stm32g473xx.h: =42 "USB Wakeup through EXTI line"), not an "unrelated interrupt"; it is simply unused here. - Comment out USBWakeUp_IRQn for F1/F3/G4/L1 and USBWakeUp_RMP_IRQn on the F3 remap path, kept in place so STOP-mode wakeup is a one-line re-enable. - Keep the STM32L1 USBWakeUp_IRQn -> USB_FS_WKUP_IRQn alias for that re-enable. - Document the rationale in fsdev_stm32.h with a TODO. - Comment out the matching USBWakeUp(_RMP)_IRQHandler in the F1/F3/G4 BSPs, and the FreeRTOS NVIC_SetPriority(USBWakeUp_IRQn) on F1/G4. Fixes #3696 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-18dcd/ch58x: drive CH582/583 with shared dcd_ch32_usbfs.chathach
Replace PR #3515's separate dcd_ch58x_usbfs.c / hcd_ch58x_usbfs.c with the shared WCH USBFS device driver (combined per-endpoint control, like CH32V103), adding two CH58x-specific behaviors guarded so CH32V103/V20x/V307 are unchanged: - CH32_USBFS_EP_MANUAL_TOG: CH58x's hardware AUTO_TOG does not stay in sync, so the ISR toggles DATA0/DATA1 manually and discards toggle-mismatched OUT packets. Fixes multi-packet bulk-IN (e.g. MSC READ10) that otherwise hung. - CH32_USBFS_EP4_SHARES_EP0: EP4 has no DMA register and overlays EP0's region (EP0[0:63] + EP4 OUT[64:127] + EP4 IN[128:191]); add a 192-byte shared buffer and buffer-pointer helpers (transparent for the other parts). Fixes cdc_dual_ports (Port1 is on EP4). Add the ch582m_evt board. Device only on USB0 (rhport 0): the shared hcd_ch32_usbfs.c is CH32V20x-specific and cannot drive CH58x, so host / USB2 (rhport 1) is left commented out in the BSP for easy re-add. Verified on ch582m_evt via local HIL: all device examples pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-18Merge remote-tracking branch 'origin/master' into add-ch58x-usbfshathach
2026-06-18dcd/ch32_usbfs: support CH32V103 combined endpoint control registerhathach
CH32V103 uses the older USBFS IP: a single combined UEPn_CTRL register per endpoint (IN response in bits [1:0], OUT response in [3:2], shared auto-toggle, separate IN/OUT toggles) instead of the separate UEPn_TX_CTRL/UEPn_RX_CTRL bytes of the newer IP (CH32V20x/V307). The shared driver was written for the newer IP, so EP0 control transfers never worked on V103: the OUT response was written to a reserved byte and the IN write clobbered the OUT bits. - ch32_usbfs_reg.h: annotate the V103 register struct with byte offsets and add a union exposing the combined UEPn_CTRL at the UEPn_TX_CTRL offset; define CH32_USBFS_EP_CTRL_COMBINED and the combined-register bit positions. - dcd_ch32_usbfs.c: abstract EP control access behind ep_tx/rx_ctrl_set() (full write) and ep_tx/rx_set_response() (response-only RMW). The newer-IP path is unchanged; the combined path read-modify-writes the single register and arms the post-SETUP data stage at DATA1. - bsp/ch32v10x: implement board_get_unique_id() (real chip UID) and drop the CSR 0x800 writes that corrupted the QingKe V3 interrupt config and left all interrupts disabled (the USB ISR never ran). Verified on ch32v103r_r1_1v0: enumerates and passes HIL for cdc_msc, hid, msc, midi, mtp, dfu, etc. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-11Merge remote-tracking branch 'origin/master' into stm32c5hathach
# Conflicts: # README.rst
2026-06-11Fix stm32f723disco host/cdc_msc_hid HIL: UART RX starvation + DWC2 DMA ↵Ha Thach
split-IN NAK storm (#3677) Fix stm32f723disco host HIL: UART RX starvation + DWC2 split bulk NAK/XactErr handling (#3677) stm32f7 BSP — UART RX starvation - The host console USART shared interrupt priority with the USB OTG ISR, so a long OTG interrupt could starve RXNE and drop received bytes. Raise the USART RX IRQ above OTG_FS/OTG_HS in both the bare-metal and FreeRTOS init paths, guarded by #ifdef UART_ID so boards without a UART console keep the default OTG priority. dwc2 host — split NAK/XactErr handling - Slave mode: a persistently-NAKing split bulk/control IN poll re-armed the start-split immediately, storming the ISR and starving task context. Throttle by disabling the channel and re-arming on the resulting halt (no frame deferral). - Buffer-DMA mode: a pure split bulk-OUT NAK was unhandled, leaving the channel halted and stalling the transfer — the dominant cause of CDC echo truncation. Handle it by rewinding the buffer pointers and retrying the start-split (Programming Guide v4.20a 5.1.4.2). - Buffer-DMA mode: a split bulk-OUT XactErr was retried immediately, exhausting HCD_XFER_ERROR_MAX before the transient cleared. Throttle via channel_disable + re-arm to give the hub TT a recovery gap, mirroring slave mode. - All three are scoped to split transfers (hcsplt.split_en); non-split NAK/XactErr keep the core-handled / immediate-retry behavior. The OUT XactErr throttle also excludes periodic split, where channel_disable() is a no-op and would wedge the channel. The nak_disabled flag is generalized to retry_disabled and honors xfer->closing so an endpoint close during a throttled retry tears down cleanly. Verified on stm32f723disco HIL (slave + CFG_TUH_DWC2_DMA_ENABLE): host/cdc_msc_hid, msc_file_explorer, and device_info all pass on both variants; DMA CDC echo went from ~15-25% raw failure to 10/10 clean.