You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for resetting RP2040 via the USB connection when using pico_stdio_usb
- setting baud rate to magic value (default=1200) will cause a reset to BOOTSEL mode
- a VENDOR interface along side the CDC interface can be used to reset via refular flash boot, or into
BOOTSEL mode with control for the reset_usb_boot parameters for the latter
either method can be configured/enabled/disabled via #define
Copy file name to clipboardexpand all lines: src/rp2_common/pico_stdio_usb/include/pico/stdio_usb.h
+33-1
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@
19
19
* Note this library is a developer convenience. It is not applicable in all cases; for one it takes full control of the USB device precluding your
20
20
* use of the USB in device or host mode. For this reason, this library will automatically disengage if you try to using it alongside \ref tinyusb_device or
21
21
* \ref tinyusb_host. It also takes control of a lower level IRQ and sets up a periodic background task.
22
+
*
23
+
* This library also includes (by default) functionality to enable the RP2040 to be reset over the USB interface.
22
24
*/
23
25
24
26
// PICO_CONFIG: PICO_STDIO_USB_DEFAULT_CRLF, Default state of CR/LF translation for USB output, type=bool, default=PICO_STDIO_DEFAULT_CRLF, group=pico_stdio_usb
@@ -31,7 +33,7 @@
31
33
#definePICO_STDIO_USB_STDOUT_TIMEOUT_US 500000
32
34
#endif
33
35
34
-
// todo perhaps unnecessarily high?
36
+
// todo perhaps unnecessarily frequent?
35
37
// PICO_CONFIG: PICO_STDIO_USB_TASK_INTERVAL_US, Period of microseconds between calling tud_task in the background, default=1000, advanced=true, group=pico_stdio_usb
36
38
#ifndefPICO_STDIO_USB_TASK_INTERVAL_US
37
39
#definePICO_STDIO_USB_TASK_INTERVAL_US 1000
@@ -42,6 +44,36 @@
42
44
#definePICO_STDIO_USB_LOW_PRIORITY_IRQ 31
43
45
#endif
44
46
47
+
// PICO_CONFIG: PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE, Enable/disable resetting into BOOTSEL mode if the host sets the baud rate to a magic value (PICO_STDIO_USB_RESET_MAGIC_BAUD_RATE), type=bool, default=1, group=pico_stdio_usb
// PICO_CONFIG: PICO_STDIO_USB_RESET_MAGIC_BAUD_RATE, baud rate that if selected causes a reset into BOOTSEL mode (if PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE==1), default=1200, group=pico_stdio_usb
53
+
#ifndefPICO_STDIO_USB_RESET_MAGIC_BAUD_RATE
54
+
#definePICO_STDIO_USB_RESET_MAGIC_BAUD_RATE 1200
55
+
#endif
56
+
57
+
// PICO_CONFIG: PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE, Enable/disable resetting into BOOTSEL mode via an additional VENDOR USB interface - enables picotool based reset, type=bool, default=1, group=pico_stdio_usb
// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL, If vendor reset interface is included allow rebooting to BOOTSEL mode, type=bool, default=1, group=pico_stdio_usb
// 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_usb
0 commit comments