Skip to content

Commit 6544bf5

Browse files
committed
Enable SNVS interrupt
The iMX RT has a separate wake up controller, the GPC, that replaces the NVIC when asleep. It adds the ability to only wake up on certain interrupts. It seems that it requires at least one enabled interrupt in the NVIC to turn on it's wake up circuitry. It doesn't need to be the same interrupt as the wake up signal. For example, the RTC in the SNVS can wake us up if a USB interrupt is enabled. Before then it won't work. So, we enable the SNVS interrupt on start up so it can wake us up.
1 parent aae0ce6 commit 6544bf5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • ports/mimxrt10xx/supervisor

ports/mimxrt10xx/supervisor/port.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ safe_mode_t port_init(void) {
252252
rtc_init();
253253
#endif
254254

255+
// Always enable the SNVS interrupt. The GPC won't wake us up unless at least one interrupt is
256+
// enabled. It won't occur very often so it'll be low overhead.
257+
NVIC_EnableIRQ(SNVS_HP_WRAPPER_IRQn);
258+
255259
// Reset everything into a known state before board_init.
256260
reset_port();
257261

@@ -365,7 +369,6 @@ void SNVS_HP_WRAPPER_IRQHandler(void) {
365369

366370
// Enable 1/1024 second tick.
367371
void port_enable_tick(void) {
368-
NVIC_EnableIRQ(SNVS_HP_WRAPPER_IRQn);
369372
uint32_t hpcr = SNVS->HPCR;
370373
hpcr &= ~SNVS_HPCR_PI_FREQ_MASK;
371374
SNVS->HPCR = hpcr | SNVS_HPCR_PI_FREQ(5) | SNVS_HPCR_PI_EN_MASK;
@@ -374,7 +377,6 @@ void port_enable_tick(void) {
374377
// Disable 1/1024 second tick.
375378
void port_disable_tick(void) {
376379
SNVS->HPCR &= ~SNVS_HPCR_PI_EN_MASK;
377-
NVIC_DisableIRQ(SNVS_HP_WRAPPER_IRQn);
378380
}
379381

380382
void port_interrupt_after_ticks(uint32_t ticks) {

0 commit comments

Comments
 (0)