powman_timer_use_gpio writing wrong value to ext_time_ref register? #2471

Closed
opened 2025-05-17 10:09:43 -05:00 by czietz · 2 comments
czietz commented 2025-05-17 10:09:43 -05:00 (Migrated from github.com)

I wonder how this can be right:

github.com/raspberrypi/pico-sdk@550aa09624/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.

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](https://github.com/user-attachments/assets/4a9dd37d-4851-4c57-a04e-3ffc0d938f1e) ... 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.
lurch commented 2025-05-17 10:30:03 -05:00 (Migrated from github.com)

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.

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.
kilograham commented 2025-07-20 17:27:24 -05:00 (Migrated from github.com)

fix merged into develop

fix merged into develop
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#2471
No description provided.