LPOSC TRIM register changes initial output frequency instead of trimming #2856
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#2856
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?
Using the powman api of the pico-sdk, the following code measures the low-power oscillator (LPOSC) output frequency using the on-board frequency counter, after having set 5 different trimming values (the minimum trimming value being 0x00, while the maximum is 0x3f):
Output:
From the 8.4.1 of the RP2350 datasheet, the trimmed frequency should be between 32kHz and 33kHz. But the values I have are between 20kHz and 36kHz. Am I doing something wrong here?
The datasheet also mentions that the initial output frequency of the LPOSC can vary between 26kHz and 39kHz. These values seem to be in the range of the ones I obtain. So if my setup is correct, could it be that the TRIM register actually impacts the initial output frequency instead of trimming?
Section 6.3.9 shows that the default value of the TRIM register is 0x20, so for your particular RP2350 chip, your "initial output frequency" is 29000 Hz, which is within the "between 26kHz and 39kHz" specification.
From my reading of the datasheet, you'd then experiment with different TRIM settings to get as close to 32.768kHz as possible, and I believe the "trimmed output frequency" in Table 616 is showing the accuracy you're able to achieve with an appropriately-selected TRIM value? So for your particular RP2350 chip, you need a TRIM value somewhere between 0x20 and 0x30 ?
Ok now I see my mistake. I thought the "min" and "max" columns of the "trimmed output frequency" were all the values you could get by changing the TRIM register from 0x00 to 0x3f. But in fact these values actually show the inaccuracy of the clock after the TRIM value has been set up (e.g., if leave the 0x20 default value, you already get an accuracy +-1.5% around 29kHz). The values in the datasheet are only an example for a specific trim value to reach 32.786 kHz (which as you say, should be between 0x20 and 0x30). Thanks!
Can this issue be closed then?
Yes, thanks!