Skip to content

Commit 9d2e179

Browse files
robert-hhdpgeorge
authored andcommitted
mimxrt: Fix CPU freeze when calling __WFE() in MICROPY_EVENT_POLL_HOOK.
This issue affected i.MX RT 1052, 1062 and 1064. It seems to be addressed by Errata ERR006223, which also mentions i.MX RT101x and 102x, but these devices worked well even without the change. As a side effect, the current consumption at an idle REPL drops significantly with this fix. Fixes issue micropython#7235.
1 parent e20bb98 commit 9d2e179

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

ports/mimxrt/boards/MIMXRT1052_clock_config.c

+1
Original file line numberDiff line numberDiff line change
@@ -465,4 +465,5 @@ void BOARD_BootClockRUN(void) {
465465
IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT2_MASK;
466466
/* Set SystemCoreClock variable. */
467467
SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
468+
CLOCK_SetMode(kCLOCK_ModeRun);
468469
}

ports/mimxrt/boards/MIMXRT1062_clock_config.c

+1
Original file line numberDiff line numberDiff line change
@@ -487,4 +487,5 @@ void BOARD_BootClockRUN(void) {
487487
IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT2_MASK;
488488
/* Set SystemCoreClock variable. */
489489
SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
490+
CLOCK_SetMode(kCLOCK_ModeRun);
490491
}

ports/mimxrt/boards/MIMXRT1064_clock_config.c

+1
Original file line numberDiff line numberDiff line change
@@ -487,4 +487,5 @@ void BOARD_BootClockRUN(void) {
487487
IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT2_MASK;
488488
/* Set SystemCoreClock variable. */
489489
SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
490+
CLOCK_SetMode(kCLOCK_ModeRun);
490491
}

ports/mimxrt/mpconfigport.h

+1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ extern const struct _mp_obj_type_t network_lan_type;
241241
do { \
242242
extern void mp_handle_pending(bool); \
243243
mp_handle_pending(true); \
244+
__WFE(); \
244245
} while (0);
245246

246247
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))

0 commit comments

Comments
 (0)