Skip to content

Commit 497345f

Browse files
committed
[nrf52] Fix millis() hang on OVERFLOW reached
1 parent 2301e03 commit 497345f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

variants/ARDUINO_NANO33BLE/variant.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ extern "C" {
5757
}
5858
}
5959

60+
#include "nrf_rtc.h"
61+
6062
void initVariant() {
6163
// turn power LED on
6264
pinMode(LED_PWR, OUTPUT);
@@ -67,6 +69,11 @@ void initVariant() {
6769
CoreDebug->DEMCR = 0;
6870
NRF_CLOCK->TRACECONFIG = 0;
6971

72+
// FIXME: bootloader enables interrupt on COMPARE[0], which we don't handle
73+
// Disable it here to avoid getting stuck when OVERFLOW irq is triggered
74+
nrf_rtc_event_disable(NRF_RTC1, NRF_RTC_INT_COMPARE0_MASK);
75+
nrf_rtc_int_disable(NRF_RTC1, NRF_RTC_INT_COMPARE0_MASK);
76+
7077
// FIXME: always enable I2C pullup and power @startup
7178
// Change for maximum powersave
7279
pinMode(PIN_ENABLE_SENSORS_3V3, OUTPUT);

0 commit comments

Comments
 (0)