machine: compute rp2 clock dividers from crystal and target frequency (#4747)

Follow-up to #4728 which implemented the algorithm for finding the
dividers.

The calculation is computed at compile time by interp, as verified by
building example/blinky1 for -target pico.
This commit is contained in:
Elias Naur
2025-02-28 23:05:27 +01:00
committed by GitHub
parent 31c4bc1151
commit 92c130c7be
2 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ var errVCOOverflow = errors.New("VCO calculation overflow; use lower MHz")
//
// Example for 12MHz crystal and RP2350:
//
// fbdiv, refdiv, pd1, pd2, _ := pllSearch{LockRefDiv:1}.CalcDivs(12*MHz, 133*MHz, MHz)
// fbdiv, refdiv, pd1, pd2, _ := pllSearch{LockRefDiv:1}.CalcDivs(12*MHz, 150*MHz, MHz)
type pllSearch struct {
LowerVCO bool
LockRefDiv uint8