Skip to content

Commit 4a21e05

Browse files
authored
Merge pull request #8170 from tannewt/fix_rp2_safe_mode
Fix rp2 safe mode via reset press
2 parents 5dc2b16 + 4e01674 commit 4a21e05

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define MICROPY_HW_MCU_NAME "rp2040"
33

44
#define MICROPY_HW_NEOPIXEL (&pin_GPIO21)
5+
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO20)
56

67
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
78
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)

ports/raspberrypi/supervisor/port.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,15 @@ uint32_t *port_heap_get_top(void) {
247247
return port_stack_get_top();
248248
}
249249

250+
uint32_t __uninitialized_ram(saved_word);
250251
void port_set_saved_word(uint32_t value) {
251-
// Store in a watchdog scratch register instead of RAM. 4-7 are used by the
252-
// sdk. 0 is used by alarm. 1-3 are free.
253-
watchdog_hw->scratch[1] = value;
252+
// Store in RAM because the watchdog scratch registers don't survive
253+
// resetting by pulling the RUN pin low.
254+
saved_word = value;
254255
}
255256

256257
uint32_t port_get_saved_word(void) {
257-
return watchdog_hw->scratch[1];
258+
return saved_word;
258259
}
259260

260261
static volatile bool ticks_enabled;

0 commit comments

Comments
 (0)