jsanchez-2g opened a new pull request, #19904:
URL: https://github.com/apache/nuttx/pull/19904
## Summary
Fix HSI48 and clock recovery system configuration required for crystal-less
USB
device operation on STM32F0 and STM32L0.
The fixes:
- Enable the CRS peripheral clock whenever HSI48 is in use, while retaining
support for boards that explicitly select CONFIG_STM32_CRS.
- Enable the CRS frequency error counter together with automatic trimming.
- Enable the SYSCFG clock when VREFINT is enabled on STM32L0.
- Write SYSCFG_CFGR3 after setting ENBUFVREFINTHSI48; previously the HSI48
voltage-reference bit was updated only in a local variable.
- Select USB SOF as the CRS synchronization source for NUCLEO-L073RZ.
Before these changes, USB device registers could appear correctly configured,
and the host could detect the D+ pull-up, but the 48 MHz clock was not
usable:
the controller did not latch USB reset in USB_ISTR and never raised its USB
interrupt.
## Impact
- New feature added: NO. Bug fixes only.
- User adaptation required: NO.
- Build impact: NO.
- Hardware impact: YES. STM32F0, STM32L0, and the shared HSI48 M0 helper,
which also supports STM32U0.
- Documentation update required: NO. Board configuration documentation is
included with the corresponding board-support PRs.
- Security impact: NO.
- Compatibility impact: Existing HSI48 users retain their selected behavior;
the CRS is now correctly enabled and able to trim the oscillator.
## Testing
Build host:
- Linux 6.18.33.2-microsoft-standard-WSL2
- arm-none-eabi-gcc 13.2.1
Hardware:
- ST NUCLEO-F072RB
- ST NUCLEO-L073RZ
Before:
- On NUCLEO-L073RZ, SYSCFG_CFGR3 read 0x00000000 because SYSCFG was
unclocked. USB_ISTR never latched host reset, and USB IRQ 47 never fired.
- Both board USB-device configurations failed enumeration when tested from
pristine apache/master plus board support.
After:
- NUCLEO-L073RZ: SYSCFG_CFGR3 enables VREFINT and the HSI48 reference;
CRS_CR enables CEN and AUTOTRIMEN; NSH and USB CDC/ACM enumeration pass.
- NUCLEO-F072RB: NSH and USB CDC/ACM enumeration pass.
- Both results were reproduced from a clean upstream NuttX plus upstream
NuttX Apps checkout after the signed histories were rebuilt.
Validation:
- ./tools/checkpatch.sh -g apache/master...usb/hsi48-crs-standalone
- File-mode checkpatch passed for all changed files.
- Real hardware build, flash, NSH, and enumeration tests passed on both
boards.
## PR verification Self-Check
- [x] This PR introduces one functional area: HSI48/CRS clock recovery fixes.
- [x] All commits include a description, Signed-off-by, and Assisted-by
trailers.
- [x] Source passes checkpatch.
- [x] Real hardware build and runtime testing was completed.
- [x] This PR is ready for review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]