You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow support of crystals other than 12MHz (#1024) (#1272)
* Allow pre-processor overrides for Clock/PLL setup
* Use `_KHZ` rather than `_MHZ` for `XOSC_` `SYS_CLOCK_` etc definitions (`_MHZ` versions are provided for compatibility when `_KHZ` is a multiple of 1000)
Co-authored-by: graham sanderson <[email protected]>
Copy file name to clipboardExpand all lines: src/rp2040/hardware_regs/include/hardware/platform_defs.h
+32-3Lines changed: 32 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -37,9 +37,38 @@
37
37
38
38
#definePIO_INSTRUCTION_COUNT _u(32)
39
39
40
-
// PICO_CONFIG: XOSC_MHZ, The crystal oscillator frequency in Mhz, type=int, default=12, advanced=true, group=hardware_base
41
-
#ifndefXOSC_MHZ
42
-
#defineXOSC_MHZ _u(12)
40
+
// PICO_CONFIG: XOSC_KHZ, The crystal oscillator frequency in kHz, type=int, default=12000, advanced=true, group=hardware_base
41
+
// NOTE: The system and USB clocks are generated from the frequency using two PLLs.
42
+
// If you override this define, or SYS_CLK_KHZ/USB_CLK_KHZ below, you will *also* need to add your own adjusted PLL set-up defines to
43
+
// override the defaults which live in src/rp2_common/hardware_clocks/include/hardware/clocks.h
44
+
// Please see the comments there about calculating the new PLL setting values.
45
+
#ifndefXOSC_KHZ
46
+
#defineXOSC_KHZ _u(12000)
47
+
#endif
48
+
49
+
// PICO_CONFIG: SYS_CLK_KHZ, The system operating frequency in kHz, type=int, default=125000, advanced=true, group=hardware_base
50
+
#ifndefSYS_CLK_KHZ
51
+
#defineSYS_CLK_KHZ _u(125000)
52
+
#endif
53
+
54
+
// PICO_CONFIG: USB_CLK_KHZ, USB clock frequency. Must be 48MHz for the USB interface to operate correctly, type=int, default=48000, advanced=true, group=hardware_base
55
+
#ifndefUSB_CLK_KHZ
56
+
#defineUSB_CLK_KHZ _u(48000)
57
+
#endif
58
+
59
+
// For backwards compatibility define XOSC_MHZ if the frequency is indeed an integer number of Mhz.
0 commit comments