Add support for resetting RP2040 via the USB connection when using pi… #197
No reviewers
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!197
Loading…
Reference in a new issue
No description provided.
Delete branch "stdio-usb-reset-to-bootsel"
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?
…co_stdio_usb
either method can be configured/enabled/disabled via #define
fixes #112
@ -45,0 +72,4 @@// PICO_CONFIG: PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS, delays in ms before rebooting via regular flash boot, default=100, group=pico_stdio_usb#ifndef PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS#define PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS 100#endifPICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATEhere should bePICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACELooks good. I didn't realise you could implement your own vendor driver like that!
Just out of curiosity, why would somebody ever need/want to change this?
(especially given that there's no similar "reset delay" for
RESET_TO_BOOTSEL)@ -45,0 +64,4 @@#define PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL 1#endif// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_FLASH_BOOT, If vendor reset interface is included allow rebooting with regular flash boot, type=bool, default=1, group=pico_stdio_usbDoes it definitely make sense to enable-this-by-default, given your comments in #112 about "the OS is understandably not keen on you trying to talk CDC commands directly to a serial device it has claimed"? 🤷♂️
@ -0,0 +41,4 @@if (request->wValue & 0x100) {gpio_mask = 1u << (request->wValue >> 9u);}reset_usb_boot(gpio_mask, request->wValue & 0x7f);Does there need to be some comments about what
request->wValuecan be set to, or will that be covered by the picotool source-code?Is there a related change to picotool that make use of this vendor interface? Or some other simple test script?
the probably don't, but no harm in creating a define since I picked an arbitrary value
@ -45,0 +64,4 @@#define PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL 1#endif// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_FLASH_BOOT, If vendor reset interface is included allow rebooting with regular flash boot, type=bool, default=1, group=pico_stdio_usbthat referred to trying to talk to a CDC device via libusb while the OS has it claime; you can use OS level things to set the baud rate just fne
I didn't either until I found out the default one forced you to use endpoints (also this way pulls in much less code)
not public yet; i tested it locally within picotool, so i could release this, but the picotool changes will come soon separately
@ -45,0 +72,4 @@// PICO_CONFIG: PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS, delays in ms before rebooting via regular flash boot, default=100, group=pico_stdio_usb#ifndef PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS#define PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS 100#endif(this was fixed in #206 )
The big question with this is now: How can the actual application (i.e. what I as a user of the SDK write) implement custom class drivers in my application? It looks like the pico SDK is using this feature of tiny-usb for internal purposes?