Skip to content

Fix/usb phy clock ungate - #160

Merged
georgevigelette merged 1 commit into
nextfrom
fix/usb-phy-clock-ungate
Oct 16, 2026
Merged

georgevigelette merged 1 commit into
nextfrom
fix/usb-phy-clock-ungate

Conversation

@georgevigelette

Copy link
Copy Markdown
Contributor

Summary

Licensing layer

  • Apache-2.0 extension (3D Slicer, wellness/veterinary module, partner SDK, language binding)
  • AGPL-3.0 core (firmware, sensing/beamforming/reconstruction/signal-processing/calibration algorithms, hardware reference design)
  • Docs / data / tooling only
  • This PR moves a file between the AGPL core and the Apache layer — if checked, this is NOT an ordinary PR: it requires the license-manifest change process (and board approval for anything leaving the core). Link the approval.

Checklist

  • Commits are signed off (DCO): git commit -s
  • New files carry the correct SPDX-License-Identifier for their layer
  • Tests and docs updated
  • No incompatible third-party code introduced
  • CI is green and CODEOWNERS review requested

Notes for reviewers

 HAL_PCD_SuspendCallback stops the PHY clock (__HAL_PCD_GATE_PHYCLOCK,
 PCGCCTL.STOPCLK), but nothing ever restarts it: HAL_PCD_ResumeCallback
 only calls USBD_LL_Resume, and the H7 HAL does not ungate on wakeup or
 on bus reset. A sensor that goes through a suspend therefore keeps a
 suspended PHY while the stack still reports CONFIGURED.

 On the bench this wedges a sensor after a power cycle or a firmware
 update: it enumerates, the host's first connect gets a pipe error about
 1 s after opening it, and from then on every bulk write times out and
 EP0 requests fail until the module is power-cycled. An SWD dump of a
 wedged sensor showed the CPU and USB stack healthy, the device
 configured at the host's address and SOFs arriving, with PCGCCTL = 0x1;
 the host's requests never reached the firmware. The bare-metal sensor
 hit it; the one behind the secure bootloader has not, most likely
 because the bootloader delays USB start past the suspend window.

 Ungate the PHY clock at the start of the resume callback (as ST's ULPI
 reference code does) and of the reset callback, since a bus reset can
 end a suspend without a resume interrupt.

 Bench, released test app 1.5.2-rc.0, bare-metal 1.8.3-rc.3 on the
 right sensor: unpatched, 4 wedges in about 14 power cycles and a
 connect-time pipe error on about half of them; patched, 10 of 10
 cycles clean with no pipe errors.

Signed-off-by: George Vigelette <george@openwater.cc>
@georgevigelette
georgevigelette force-pushed the fix/usb-phy-clock-ungate branch from 0920189 to 0699bd1 Compare October 16, 2026 20:18
@georgevigelette
georgevigelette merged commit 59c8b79 into next Oct 16, 2026
3 checks passed
@georgevigelette
georgevigelette deleted the fix/usb-phy-clock-ungate branch October 16, 2026 20:20
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.

1 participant