set_sys_clock_khz() cannot be called multiple times #94
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#94
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For automatically determining maximal overclock frequency, too high clock frequencies need to be tested (binary search). I stripped down my code to very short example demonstrating the inconsistent behavior for frequency 424000 KHz.
Minicom output:
The ok output shows that set_sys_clock_khz(424000, false) returned true.
But calling set_sys_clock_khz(424000, true) afterwards results in assert(panic).
Code:
I need to figure out if a I can set system clock to a specific value. In case above behavior is considered OK (hopefully not), another function is needed to query whether setting system clock with 2nd argument true would panic or not.
There is a function
however this is what is called by
set_sys_clock_khz(..., false)It seems like set_sys_clock_khz() fails if it is called twice; this is a bug
Your repro is running the system at 424 MHz the second time the function is called. See the function description here:
When I run your code unmodified (i.e. trying to run the system at 424 MHz), it crashes immediately for me; I don't get the same failure you see. When I reduce the frequency to something within the range given in our datasheet, the function works as documented and as expected.
Please post a complete reproducible example that does not run the chip faster than 133 MHz.
Please open another issue if you are able to reproduce this behaviour whilst running within the frequency range given in the datasheet.
I found a way to deal with the high frequencies and automatically determine the highest safe frequency per voltage:
https://www.raspberrypi.org/forums/viewtopic.php?f=145&t=301902&start=50#p1820197
I had to call "set_sys_clock_khz(_, false)" twice, because calling 2nd time after 1st call confirmed that frequency is valid crashed.
I can understand that you close this bug, I will have to see whether I get the crash as well with <=133MHz.
In that case I would reopen this bug, because your closing argument was running above rater 133MHz frequency.
The Pico is a nice piece of hardware, running safely with >420MHz with four different Picos with working GPIO at 1.3V is so cool (for applications needing overclocking). Even USB output at such high frequencies is possible, one has just to clock down (I use "set_sys_clock_48MHz()") and wait a bit (I do "sleep_ms(2)", then printf works, and afterwards overclocking again works as well.