clock_configure() will stop sysclock entirely if ROSC is not running #1589
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 assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#1589
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?
In https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_clocks/clocks.c the function clock_configure() contains this code snippet
The bug is in:
If before running clock_configure(), ROSC has been disabled (by rosc_disable() or changing clocks_hw->wake_en0 bits respectively), then this line will switch the glitchless mux to ROSC. The result is a halted sysclock.
The line does not check whether ROSC is enabled at all or whether it would be better to use XOSC.
Any comment @andygpz11 ?
@peterharperuk It does appear the SDK does not automatically handle the case where ROSC has been disabled after boot.
@canique For now, can you:
?
I think we might look to improve this behaviour although, as a general rule, we try to keep the SDK very thin and provide all the APIs needed to allow full control of the RP2040.
Thanks.
For a developer an error like this is extremely hard to find. Pretty impossible to debug, hard to spot (I had to write a little framework to find it), and undocumented.
The reference manual says ROSC can be disabled for power saving purposes. It does not say that changing the clock speed in the SDK breaks everything if ROSC has been disabled.
I am sorry this was hard to discover. We will improve the documentation to make this clear and consider if the SDK should automatically handle this case.