diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-06-22 21:10:12 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-07-04 10:11:02 -0400 |
commit | 59fe8782415718b03eb89dd00f25ed1d6cb1ac32 (patch) | |
tree | d324ef31d976634fb2fc3e27c8f10434b79a42f5 /src/rp2040/main.c | |
parent | 045bfa4e8d177ca934815dd16fa8700543578328 (diff) | |
download | kutter-59fe8782415718b03eb89dd00f25ed1d6cb1ac32.tar.gz kutter-59fe8782415718b03eb89dd00f25ed1d6cb1ac32.tar.xz kutter-59fe8782415718b03eb89dd00f25ed1d6cb1ac32.zip |
rp2040: Add initial adc support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/rp2040/main.c')
-rw-r--r-- | src/rp2040/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rp2040/main.c b/src/rp2040/main.c index 35e4f55d..7b36856a 100644 --- a/src/rp2040/main.c +++ b/src/rp2040/main.c @@ -42,6 +42,7 @@ DECL_INIT(watchdog_init); #define FREQ_XOSC 12000000 #define FREQ_SYS 125000000 +#define FREQ_USB 48000000 void enable_pclock(uint32_t reset_bit) @@ -126,8 +127,13 @@ clock_setup(void) while (!(csys->selected & (1 << 1))) ; - // Setup clk_peri + // Setup pll_usb + enable_pclock(RESETS_RESET_PLL_USB_BITS); + pll_setup(pll_usb_hw, 40, 40*FREQ_XOSC/FREQ_USB); + + // Setup clk_peri and clk_adc clk_aux_setup(clk_peri, CLOCKS_CLK_PERI_CTRL_AUXSRC_VALUE_CLK_SYS); + clk_aux_setup(clk_adc, CLOCKS_CLK_ADC_CTRL_AUXSRC_VALUE_CLKSRC_PLL_USB); // Enable watchdog tick (at 12Mhz) cref->div = 1<<CLOCKS_CLK_REF_DIV_INT_LSB; |