Replies: 4 comments
-
Dear, |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for this post!
Those 2 tiny details are a bit different. This "clk_peri switches to 48Mhz" issue also occurs when setting I think it occurs because, when this core starts, it sets clk_sys to the user-chosen/or default 133Mhz "CPU Speed" (Arduino IDE) / Alternative workaround that runs RP2040 entirely within spec: |
Beta Was this translation helpful? Give feedback.
-
Works great, thanks. This simple change boosted the read speed of my external ADC from 600ksps to 800ksps, neat! |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying to run CPU at 250 MHz (this is fine with set_sys_clock_khz) and QSPI clock at 125 MHz... is this possible ? This works fine with pico-sdk but something weird happens with arduino-pico where QSPI clock goes at 62.5 MHz... Thanks in advance |
Beta Was this translation helpful? Give feedback.
-
If the processor is clocked at frequencies above 125MHz then the peripheral clock (peri_clk) that feeds the SPI and UART is switched to 48MHz. This is because the peripherals attached to peri_clk are only specified to operate at 125MHz maximum. The automatic reduction of the clock to 48MHz means that the maximum SPI rate is decreased to 24MHz for any CPU frequency above 125MHz, this includes the default 133MHz setting with this core package.
To operate at SPI clock frequencies above 24MHz at CPU frequencies above 125MHz it is necessary to over-clock the peripheral clock.
It is possible to switch the SPI and UART clock back to the processor frequency, the maximum SPI rate is then half the processor frequency. This frequency switch must be done at the very start of setup() before any Serialx channel baud rates are set and before the SPI gets configured. Later the clock dividers for the SPI and UART baud rates will get correctly configured when requested.
The UART and SPI will get overclocked with the procesor and thus may not function at high over-clock speeds. I tested at 250MHz CPU clock and all seems to work fine.
Here is the code to boost the peri_clk speed:
Beta Was this translation helpful? Give feedback.
All reactions