fix: make PLL2M dynamic to keep VCO=800MHz for any HSE frequency (closes #11594)#11596
fix: make PLL2M dynamic to keep VCO=800MHz for any HSE frequency (closes #11594)#11596daijoubu wants to merge 2 commits into
Conversation
PLL2M was hardcoded to 5, which assumes HSE = 8 MHz (giving VCO = 800 MHz). On KakuteH7Wing (HSE = 16 MHz), VCO = 16/5 * 500 = 1600 MHz, far exceeding the STM32H7 specification. This caused the SDMMC kernel clock (PLL2R = 4) to run at 400 MHz instead of the required 200 MHz. Fix: compute PLL2M from HSE_VALUE (same formula as PLL1M) and reduce PLL2N from 500 to 400, pinning VCO to 800 MHz for any HSE frequency: - HSE=8: M=4, N=400 → VCO=800 MHz - HSE=16: M=8, N=400 → VCO=800 MHz Closes iNavFlight#11594
|
Test firmware build ready — commit Download firmware for PR #11596 237 targets built. Find your board's
|
With VCO = 800 MHz, PLL2P = 2 gives 800/2 = 400 MHz.
|
Original comment on PLL2P was incorrect at 500 MHz. Standard HSE source is 8 MHz.
|
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Accidentally changed PLL2M to give a VCO input of 2 MHz instead of 1.6 MHz. Works, but VCIRANGE is now incorrect. Better to shift it back to 1.6 MHz. Will test tomorrow and the update. |
|
This PR was closed when its branch was deleted during a rebase. The updated fix has been opened as #11603. |
Summary
PLL2M was hardcoded to 5, which assumes HSE = 8 MHz (giving VCO = 800 MHz).
On KakuteH7Wing (HSE = 16 MHz), VCO = 16/5 * 500 = 1600 MHz, far exceeding
the STM32H7 specification. This caused the SDMMC kernel clock (PLL2R = 4)
to run at 400 MHz instead of the expected 200 MHz.
Fix
Compute PLL2M from HSE_VALUE (same formula as PLL1M) and reduce PLL2N
from 500 to 400, pinning VCO to 800 MHz for any HSE frequency:
Testing
Build: KAKUTEH7WING Release — 0 errors, 0 warnings
SD card test 1 (detection): PASS — card detected, filesystem Ready
SD card test 2 (write): 4 MB written in 60s at 68 KB/s, no errors
Closes #11594
Risk
Low — only affects H7 targets with HSE ≠ 8 MHz (currently only
KAKUTEH7WING at 16 MHz). For all standard 8 MHz HSE targets the
VCO remains 800 MHz (M goes from 5 to 4, N from 500 to 400).