Skip to content

Commit b2a08e2

Browse files
committed
use right DBL_TAP_REG when resetting to bootloader
This helps my development scripts work better, and probably also fixes a problem switching from the circuitpython environment back to arduino. (specifically, the "1200 baud" serial trick was not rebooting into the bootloader but was just resetting)
1 parent 8a8579a commit b2a08e2

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

ports/mimxrt10xx/common-hal/microcontroller/__init__.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
#include "supervisor/shared/safe_mode.h"
4040
#include "supervisor/shared/translate/translate.h"
4141

42-
#define DBL_TAP_REG SNVS->LPGPR[3]
43-
4442
void common_hal_mcu_delay_us(uint32_t delay) {
4543
mp_hal_delay_us(delay);
4644
}

ports/mimxrt10xx/reset.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "py/mpconfig.h"
3434

3535
// Copied from inc/uf2.h in https://github.com/Microsoft/uf2-samd21
36+
#define DBL_TAP_REG SNVS->LPGPR[3]
3637
#define DBL_TAP_MAGIC 0xf01669ef // Randomly selected, adjusted to have first and last bit set
3738
#define DBL_TAP_MAGIC_QUICK_BOOT 0xf02669ef
3839

ports/mimxrt10xx/supervisor/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ void reset_port(void) {
301301
}
302302

303303
void reset_to_bootloader(void) {
304-
SNVS->LPGPR[0] = DBL_TAP_MAGIC;
304+
DBL_TAP_REG = DBL_TAP_MAGIC;
305305
reset();
306306
}
307307

0 commit comments

Comments
 (0)