Skip to content

Commit 33818dd

Browse files
Increase PLL min VCO from 400MHz to 750MHz for improved stability across operating conditions (#869)
Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
1 parent 8f09099 commit 33818dd

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

src/rp2040/hardware_regs/include/hardware/regs/pll.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
2+
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
@@ -17,7 +17,7 @@
1717
// GENERAL CONSTRAINTS:
1818
// Reference clock frequency min=5MHz, max=800MHz
1919
// Feedback divider min=16, max=320
20-
// VCO frequency min=400MHz, max=1600MHz
20+
// VCO frequency min=750MHz, max=1600MHz
2121
#define PLL_CS_OFFSET _u(0x00000000)
2222
#define PLL_CS_BITS _u(0x8000013f)
2323
#define PLL_CS_RESET _u(0x00000001)

src/rp2040/hardware_regs/rp2040.svd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22367,7 +22367,7 @@
2236722367
GENERAL CONSTRAINTS:\n
2236822368
Reference clock frequency min=5MHz, max=800MHz\n
2236922369
Feedback divider min=16, max=320\n
22370-
VCO frequency min=400MHz, max=1600MHz</description>
22370+
VCO frequency min=750MHz, max=1600MHz</description>
2237122371
<fields>
2237222372
<field>
2237322373
<access>read-only</access>

src/rp2_common/hardware_clocks/clocks.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ void clocks_init(void) {
148148
/// \tag::pll_settings[]
149149
// Configure PLLs
150150
// REF FBDIV VCO POSTDIV
151-
// PLL SYS: 12 / 1 = 12MHz * 125 = 1500MHZ / 6 / 2 = 125MHz
152-
// PLL USB: 12 / 1 = 12MHz * 40 = 480 MHz / 5 / 2 = 48MHz
151+
// PLL SYS: 12 / 1 = 12MHz * 125 = 1500MHz / 6 / 2 = 125MHz
152+
// PLL USB: 12 / 1 = 12MHz * 100 = 1200MHz / 5 / 5 = 48MHz
153153
/// \end::pll_settings[]
154154

155155
/// \tag::pll_init[]
156156
pll_init(pll_sys, 1, 1500 * MHZ, 6, 2);
157-
pll_init(pll_usb, 1, 480 * MHZ, 5, 2);
157+
pll_init(pll_usb, 1, 1200 * MHZ, 5, 5);
158158
/// \end::pll_init[]
159159

160160
// Configure clocks

src/rp2_common/hardware_clocks/scripts/vcocalc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
parser = argparse.ArgumentParser(description="PLL parameter calculator")
66
parser.add_argument("--input", "-i", default=12, help="Input (reference) frequency. Default 12 MHz", type=float)
77
parser.add_argument("--vco-max", default=1600, help="Override maximum VCO frequency. Default 1600 MHz", type=float)
8-
parser.add_argument("--vco-min", default=400, help="Override minimum VCO frequency. Default 400 MHz", type=float)
8+
parser.add_argument("--vco-min", default=750, help="Override minimum VCO frequency. Default 750 MHz", type=float)
99
parser.add_argument("--low-vco", "-l", action="store_true", help="Use a lower VCO frequency when possible. This reduces power consumption, at the cost of increased jitter")
1010
parser.add_argument("output", help="Output frequency in MHz.", type=float)
1111
args = parser.parse_args()

src/rp2_common/hardware_pll/include/hardware/pll.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ typedef pll_hw_t *PLL;
3131
#define pll_sys pll_sys_hw
3232
#define pll_usb pll_usb_hw
3333

34+
#ifndef PICO_PLL_VCO_MIN_FREQ_MHZ
35+
#define PICO_PLL_VCO_MIN_FREQ_MHZ 750
36+
#endif
37+
38+
#ifndef PICO_PLL_VCO_MAX_FREQ_MHZ
39+
#define PICO_PLL_VCO_MAX_FREQ_MHZ 1600
40+
#endif
41+
3442
/*! \brief Initialise specified PLL.
3543
* \ingroup hardware_pll
3644
* \param pll pll_sys or pll_usb

src/rp2_common/hardware_pll/pll.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
void pll_init(PLL pll, uint refdiv, uint vco_freq, uint post_div1, uint post_div2) {
1414
uint32_t ref_mhz = XOSC_MHZ / refdiv;
1515

16+
// Check vco freq is in an acceptable range
17+
assert(vco_freq >= (PICO_PLL_VCO_MIN_FREQ_MHZ * MHZ) && vco_freq <= (PICO_PLL_VCO_MAX_FREQ_MHZ * MHZ));
18+
1619
// What are we multiplying the reference clock by to get the vco freq
1720
// (The regs are called div, because you divide the vco output and compare it to the refclk)
1821
uint32_t fbdiv = vco_freq / (ref_mhz * MHZ);

src/rp2_common/pico_stdlib/stdlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ bool check_sys_clock_khz(uint32_t freq_khz, uint *vco_out, uint *postdiv1_out, u
7373
uint crystal_freq_khz = clock_get_hz(clk_ref) / 1000;
7474
for (uint fbdiv = 320; fbdiv >= 16; fbdiv--) {
7575
uint vco = fbdiv * crystal_freq_khz;
76-
if (vco < 400000 || vco > 1600000) continue;
76+
if (vco < PICO_PLL_VCO_MIN_FREQ_MHZ * 1000 || vco > PICO_PLL_VCO_MAX_FREQ_MHZ * 1000) continue;
7777
for (uint postdiv1 = 7; postdiv1 >= 1; postdiv1--) {
7878
for (uint postdiv2 = postdiv1; postdiv2 >= 1; postdiv2--) {
7979
uint out = vco / (postdiv1 * postdiv2);

0 commit comments

Comments
 (0)