Skip to content

Commit 654d217

Browse files
gianstacarlescufi
authored andcommitted
drivers: nrf_rtc_timer: force init of interrupt and event enabling
Make sure that the interrupt and event routing enable bits have the reset values in case the Zephyr firmware image is chain-loaded. When started by MCUboot, these registers values aren't the reset values, but then Zephyr initializes them in same way. Yet, when the Zephyr firmware image is chain-loaded by nRF5 bootloader, they may have values that cause the scheduler to behave in unexpected ways. Signed-off-by: Giancarlo Stasi <[email protected]>
1 parent bc612b8 commit 654d217

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/timer/nrf_rtc_timer.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,18 @@ static int sys_clock_driver_init(const struct device *dev)
666666
(IS_ENABLED(CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY) ?
667667
CLOCK_CONTROL_NRF_LF_START_AVAILABLE :
668668
CLOCK_CONTROL_NRF_LF_START_STABLE);
669+
uint32_t mask = NRF_RTC_INT_TICK_MASK |
670+
NRF_RTC_INT_OVERFLOW_MASK |
671+
NRF_RTC_INT_COMPARE0_MASK |
672+
NRF_RTC_INT_COMPARE1_MASK |
673+
NRF_RTC_INT_COMPARE2_MASK |
674+
NRF_RTC_INT_COMPARE3_MASK;
675+
676+
/* Reset interrupt enabling to expected reset values */
677+
nrf_rtc_int_disable(RTC, mask);
678+
679+
/* Reset event routing enabling to expected reset values */
680+
nrf_rtc_event_disable(RTC, mask);
669681

670682
/* TODO: replace with counter driver to access RTC */
671683
nrf_rtc_prescaler_set(RTC, 0);

0 commit comments

Comments
 (0)