Add library for reset interface#2629
Conversation
|
Any reason this has stalled? I'd quite like to use this, so my project can handle reset to reconfigure in a new mode. |
|
I've been using this PR in a project for a while now, which isn't great, but it has been working. |
|
Looks like this PR has conflicts which need resolving? @will-v-pi |
Cleaner way of separating the usb_reset_interface.h header
… header remains the same
pico_usb_reset_... -> usb_reset_... PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB -> PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB Add to docs/index.h
I've rebased it onto develop to resolve those - this PR is awaiting review by @kilograham |
|
oops - sorry i seem to have ignored this!
|
I can rename the new library to |
Include backwards compatibility with old define names Also fix bazel build
|
Actually, maybe just |
…e_low bit (raspberrypi#2947) commit 97ed432 Author: Graham Sanderson <graham.sanderson@raspberrypi.com> Date: Tue May 19 17:37:03 2026 -0500 grr commit 90c5d5a Author: Graham Sanderson <graham.sanderson@raspberrypi.com> Date: Tue May 19 17:36:27 2026 -0500 missing ) in comment commit 082e459 Author: Graham Sanderson <graham.sanderson@raspberrypi.com> Date: Tue May 19 17:35:37 2026 -0500 Re-arrange bit patterns to be more backwards compatible commit e243616 Author: Andrii Anoshyn <anoshyn.andrii@gmail.com> Date: Sat May 16 14:29:23 2026 +0300 pico_stdio_usb: fix overlap between activity-LED GPIO and active_low bit The bootsel reset USB control transfer encodes the activity-LED GPIO in wValue. The current layout reads: if (request->wValue & 0x100) { gpio = request->wValue >> 9u; } active_low = request->wValue & 0x200; Bit 9 (0x200) is the active_low flag, but `gpio = wValue >> 9` also makes bit 9 the low bit of the extracted GPIO number. As a result: - Any odd-numbered activity-LED GPIO is silently flagged active_low. - Any client wanting active_low has the GPIO number's low bit forced. The active_low line was added in commit 5a98889 (\"add rom_reset_usb_boot_extra which supports >32 pins and ACTIVE_LOW\") on top of the original \"gpio = wValue >> 9\" encoding from commit 383e88e, without shifting the gpio over by an extra bit to make room. See raspberrypi#2713. Shift the GPIO extraction to (wValue >> 10) so bit 9 is reserved for active_low alone. The resulting GPIO field is 6 bits (0-63), enough for RP2040 (30 GPIOs) and RP2350 (48 GPIOs). The canonical client (picotool) only sends wValue=disable_mask with bits 0-1 set, so this does not change any in-tree behavior; the change is only visible to out-of-tree clients that build wValue with the GPIO-specified bit set. Fixes raspberrypi#2713.
|
ok, so there was maybe a bit of a miscommunication on the renaming, but i have looked at it again anyway. I am cool with leaving it called even though they are long, we should probably keep PICO_USB_RESET_INTERFACE_ in the names to be consistent (i could handle contraction to IFC i guess) It's kinda ugly, but the real headers really belong in rp2_common, so i'd actually put them with the code in rp2_common, but add them to the pico_usb_reset_interface_headers, and #include them from the original one guarded by a |
Sorry, I was occupied with other stuff - I think the rename to |
Place vendor interface defines after PICO_ENABLE_USB_RESET_VIA_VENDOR_INTERFACE, and bootsel defines after PICO_USB_RESET_SUPPORT_RESET_TO_BOOTSEL
| 'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, 'c', 0x00, 'e', 0x00, 'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, \ | ||
| 'r', 0x00, 'f', 0x00, 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, 'U', 0x00, 'I', 0x00, 'D', 0x00, 0x00, 0x00, \ |
There was a problem hiding this comment.
Not directly-related to this PR (so feel free to ignore this suggestion), but maybe this could be reformatted to:
| 'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, 'c', 0x00, 'e', 0x00, 'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, \ | |
| 'r', 0x00, 'f', 0x00, 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, 'U', 0x00, 'I', 0x00, 'D', 0x00, 0x00, 0x00, \ | |
| 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0, \ | |
| 'I', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, \ | |
| 'a', 0, 'c', 0, 'e', 0, 'G', 0, 'U', 0, 'I', 0, \ | |
| 'D', 0, 0, 0, \ |
as this would then match the formatting of the {bc7398c1-... UTF-16 string below?
This separates the stdio_usb reset interface out into a separate library, which can be used by applications which use TinyUSB directly.
No change in behaviour when using the typical stdio_usb (eg in the hello_usb example).
Keeps the
PICO_STDIO_USB_prefix on the config defines to maintain compatibility, and also maintains compatibility with picotool.Instructions to use this are added to the header file.
See implementation in debugprobe and the dev_multi_cdc example