pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

powman_timer_use_gpio writing wrong value to ext_time_ref register?

Open czietz opened this issue 8 months ago • 1 comments

I wonder how this can be right:

https://github.com/raspberrypi/pico-sdk/blob/550aa09624391dfbc3afae55ede3e008a3879614/src/rp2_common/hardware_powman/powman.c#L100-L111

According to the RP2350 datasheet:

Image

... ext_time_ref does not directly take the GPIO number (12, 20, 14, 22), but is an enum (0 ... 3). However, the function above writes the GPIO number directly into the register.

czietz avatar May 17 '25 15:05 czietz

https://github.com/raspberrypi/pico-sdk/blob/develop/src/rp2350/hardware_regs/include/hardware/regs/powman.h#L1180 seems to agree - looks like you might have found a bug? It's probably just reading the lower 2 bits of the GPIO value, so trying to set either 12 or 20 will result in GPIO12 being selected, and trying to set 14 or 22 will result in GPIO14 being selected.

lurch avatar May 17 '25 15:05 lurch

fix merged into develop

kilograham avatar Jul 20 '25 22:07 kilograham