Clock configuration for the RP2350. More...
Clock configuration for the RP2350.
Definition in file clock_conf.h.
Go to the source code of this file.
#define | XOSC_CTRL_FREQ_RANGE_VALUE_1_15MHZ 0xaa0u |
1-15 MHz range | |
#define | XOSC_CTRL_FREQ_RANGE_VALUE_10_30MHZ 0xaa1u |
10-30 MHz range | |
#define | XOSC_CTRL_FREQ_RANGE_VALUE_25_60MHZ 0xaa2u |
25-60 MHz range | |
#define | XOSC_CTRL_FREQ_RANGE_VALUE_40_100MHZ 0xaa3u |
40-100 MHz range | |
#define | XOSC_CTRL_ENABLE_VALUE_DISABLE 0xd1eu |
Disable the XOSC. | |
#define | XOSC_CTRL_ENABLE_VALUE_ENABLE 0xfabu |
Enable the XOSC. | |
#define | XOSC_CTRL_ENABLE_LSB 12u |
LSB of the enable bit. | |
#define | XOSC_STATUS_STABLE_BITS 0x80000000u |
Stable bit in the XOSC status register. | |
#define | XOSC_HZ MHZ(12u) |
Default crystal frequency is 12 MHz. | |
#define | PLL_REF_DIV 2u |
Reference divider for the PLL, set to 2 as per hardware manual. | |
#define | PLL_VCO_FREQ 750000000u |
VCO frequency for the PLL, set to 750 MHz as per hardware manual. | |
#define | PLL_PD1 6u |
Post divider 1 for the PLL, set to 6 as per hardware manual. | |
#define | PLL_PD2 2u |
Post divider 2 for the PLL, set to 2 as per hardware manual. | |
#define | PLL_PWR_PD_BITS 0x00000001u |
Power down bits for the PLL. | |
#define | PLL_PWR_VCOPD_BITS 0x00000020u |
VCO power down bits for the PLL. | |
#define | PLL_CS_LOCK_BITS 0x80000000u |
Lock bit in the PLL control status register. | |
#define | PLL_PRIM_POSTDIV1_LSB 16u |
LSB of the post divider 1 in the PLL primary register. | |
#define | PLL_PRIM_POSTDIV2_LSB 12u |
LSB of the post divider 2 in the PLL primary register. | |
#define | PLL_PWR_POSTDIVPD_BITS 0x00000008u |
Post divider power down bits for the PLL. | |
#define | CLK_PERI_CTRL_ENABLE_BIT (1u << 11u) |
Enable bit for the peripheral clock control register. | |
#define | CPUFREQ 125000000u |
Default CPU frequency in Hz, set to 125 MHz as per hardware manual. | |
#define | CLOCK_XOSC_MAX MHZ(15u) |
Maximum crystal frequency. | |
#define | CLOCK_XOSC_MIN MHZ(5u) |
Minimum crystal frequency. | |
#define | CLOCK_XOSC (XOSC_HZ) |
Crystal frequency. | |
#define | PLL_POSTDIV_MIN 1u |
Minimum value of the post PLL clock divers. | |
#define | PLL_POSTDIV_MAX 7u |
Maximum value of the post PLL clock divers. | |
#define | PLL_VCO_FEEDBACK_SCALE_MIN 16u |
Minimum value of the PLL VCO feedback scaler. | |
#define | PLL_VCO_FEEDBACK_SCALE_MAX 320u |
Maximum value of the PLL VCO feedback scaler. | |
#define | PLL_REF_DIV_MIN 1u |
Minimum value of the clock divider applied before feeding in the reference clock into the PLL. | |
#define | PLL_REF_DIV_MAX 1u |
Minimum value of the clock divider applied before feeding in the reference clock into the PLL. | |
#define | PLL_FEEDBACK_DIVIDER_VALUE 125u |
PLL feedback divider value, set to 125 as per hardware manual. | |
#define | CLK_SYS_PERI_CTRL_ENABLE_BIT (1u << 0u) |
Enable bit for the system clock control register to select the peripheral clock. | |
#define | CLK_SYS_SELECTED_PERI_FIELD_VALUE 2u |
Selected field value for the system clock control register to select the peripheral clock. | |
#define | CLOCK_CORECLOCK MHZ(12u) |
RIOT core clock frequency defined as the CPU frequency. | |
#define | PDIV ((PLL_PD1 << PLL_PRIM_POSTDIV1_LSB) | (PLL_PD2 << PLL_PRIM_POSTDIV2_LSB)) |
Post divider for the PLL, calculated based on the post divider values. | |
#define | FBDIV ((PLL_VCO_FREQ / XOSC_HZ) / PLL_REF_DIV) |
Feedback divider for the PLL, calculated based on the VCO frequency and reference clock frequency. | |
void | xosc_start (void) |
Configures the Crystal to run. | |
void | xosc_stop (void) |
Stop the crystal. | |
void | xosc_sleep (uint32_t milliseconds) |
Sleep for a given time in milliseconds. | |
void | clock_reset (void) |
Reset the clock system. | |
void | cpu_clock_init (void) |
Configures the XOSC and then sets CLK_SYS, PLL_SYS and CLK_PERI to it. | |
#define CLK_PERI_CTRL_ENABLE_BIT (1u << 11u) |
Enable bit for the peripheral clock control register.
Definition at line 63 of file clock_conf.h.
#define CLK_SYS_PERI_CTRL_ENABLE_BIT (1u << 0u) |
Enable bit for the system clock control register to select the peripheral clock.
Definition at line 90 of file clock_conf.h.
#define CLK_SYS_SELECTED_PERI_FIELD_VALUE 2u |
Selected field value for the system clock control register to select the peripheral clock.
Definition at line 93 of file clock_conf.h.
#define CLOCK_CORECLOCK MHZ(12u) |
RIOT core clock frequency defined as the CPU frequency.
Definition at line 95 of file clock_conf.h.
#define CLOCK_XOSC (XOSC_HZ) |
Crystal frequency.
Definition at line 71 of file clock_conf.h.
#define CLOCK_XOSC_MAX MHZ(15u) |
Maximum crystal frequency.
Definition at line 67 of file clock_conf.h.
#define CLOCK_XOSC_MIN MHZ(5u) |
Minimum crystal frequency.
Definition at line 69 of file clock_conf.h.
#define CPUFREQ 125000000u |
Default CPU frequency in Hz, set to 125 MHz as per hardware manual.
Definition at line 65 of file clock_conf.h.
#define FBDIV ((PLL_VCO_FREQ / XOSC_HZ) / PLL_REF_DIV) |
Feedback divider for the PLL, calculated based on the VCO frequency and reference clock frequency.
Definition at line 115 of file clock_conf.h.
#define PDIV ((PLL_PD1 << PLL_PRIM_POSTDIV1_LSB) | (PLL_PD2 << PLL_PRIM_POSTDIV2_LSB)) |
Post divider for the PLL, calculated based on the post divider values.
Definition at line 112 of file clock_conf.h.
#define PLL_CS_LOCK_BITS 0x80000000u |
Lock bit in the PLL control status register.
Definition at line 55 of file clock_conf.h.
#define PLL_FEEDBACK_DIVIDER_VALUE 125u |
PLL feedback divider value, set to 125 as per hardware manual.
Definition at line 87 of file clock_conf.h.
#define PLL_PD1 6u |
Post divider 1 for the PLL, set to 6 as per hardware manual.
Definition at line 47 of file clock_conf.h.
#define PLL_PD2 2u |
Post divider 2 for the PLL, set to 2 as per hardware manual.
Definition at line 49 of file clock_conf.h.
#define PLL_POSTDIV_MAX 7u |
Maximum value of the post PLL clock divers.
Definition at line 75 of file clock_conf.h.
#define PLL_POSTDIV_MIN 1u |
Minimum value of the post PLL clock divers.
Definition at line 73 of file clock_conf.h.
#define PLL_PRIM_POSTDIV1_LSB 16u |
LSB of the post divider 1 in the PLL primary register.
Definition at line 57 of file clock_conf.h.
#define PLL_PRIM_POSTDIV2_LSB 12u |
LSB of the post divider 2 in the PLL primary register.
Definition at line 59 of file clock_conf.h.
#define PLL_PWR_PD_BITS 0x00000001u |
Power down bits for the PLL.
Definition at line 51 of file clock_conf.h.
#define PLL_PWR_POSTDIVPD_BITS 0x00000008u |
Post divider power down bits for the PLL.
Definition at line 61 of file clock_conf.h.
#define PLL_PWR_VCOPD_BITS 0x00000020u |
VCO power down bits for the PLL.
Definition at line 53 of file clock_conf.h.
#define PLL_REF_DIV 2u |
Reference divider for the PLL, set to 2 as per hardware manual.
Definition at line 43 of file clock_conf.h.
#define PLL_REF_DIV_MAX 1u |
Minimum value of the clock divider applied before feeding in the reference clock into the PLL.
Definition at line 85 of file clock_conf.h.
#define PLL_REF_DIV_MIN 1u |
Minimum value of the clock divider applied before feeding in the reference clock into the PLL.
Definition at line 82 of file clock_conf.h.
#define PLL_VCO_FEEDBACK_SCALE_MAX 320u |
Maximum value of the PLL VCO feedback scaler.
Definition at line 79 of file clock_conf.h.
#define PLL_VCO_FEEDBACK_SCALE_MIN 16u |
Minimum value of the PLL VCO feedback scaler.
Definition at line 77 of file clock_conf.h.
#define PLL_VCO_FREQ 750000000u |
VCO frequency for the PLL, set to 750 MHz as per hardware manual.
Definition at line 45 of file clock_conf.h.
#define XOSC_CTRL_ENABLE_LSB 12u |
LSB of the enable bit.
Definition at line 37 of file clock_conf.h.
#define XOSC_CTRL_ENABLE_VALUE_DISABLE 0xd1eu |
Disable the XOSC.
Definition at line 33 of file clock_conf.h.
#define XOSC_CTRL_ENABLE_VALUE_ENABLE 0xfabu |
Enable the XOSC.
Definition at line 35 of file clock_conf.h.
#define XOSC_CTRL_FREQ_RANGE_VALUE_10_30MHZ 0xaa1u |
10-30 MHz range
Definition at line 27 of file clock_conf.h.
#define XOSC_CTRL_FREQ_RANGE_VALUE_1_15MHZ 0xaa0u |
1-15 MHz range
Definition at line 25 of file clock_conf.h.
#define XOSC_CTRL_FREQ_RANGE_VALUE_25_60MHZ 0xaa2u |
25-60 MHz range
Definition at line 29 of file clock_conf.h.
#define XOSC_CTRL_FREQ_RANGE_VALUE_40_100MHZ 0xaa3u |
40-100 MHz range
Definition at line 31 of file clock_conf.h.
#define XOSC_HZ MHZ(12u) |
Default crystal frequency is 12 MHz.
Definition at line 41 of file clock_conf.h.
#define XOSC_STATUS_STABLE_BITS 0x80000000u |
Stable bit in the XOSC status register.
Definition at line 39 of file clock_conf.h.
void clock_reset | ( | void | ) |
Reset the clock system.
This function resets the clock system to a known state. It is recommended to call this function before configuring the clock system.
void cpu_clock_init | ( | void | ) |
Configures the XOSC and then sets CLK_SYS, PLL_SYS and CLK_PERI to it.
void xosc_sleep | ( | uint32_t | milliseconds | ) |
Sleep for a given time in milliseconds.
milliseconds | The time to sleep in milliseconds. |
void xosc_start | ( | void | ) |
Configures the Crystal to run.