From f63fb2a26facbd4ab599f399fd1e70b92057a55b Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Thu, 10 Nov 2016 16:47:25 +0000 Subject: [PATCH] Fix a bug related to the RTC interrupt enabled. Enable the interrupt for the OS tick when the OS tick is enabled rather than all the time. Otherwise, the interrupt will be triggered bu never handled. --- targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c index f4e9911569..d3a9c9d63e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c @@ -110,9 +110,6 @@ void common_rtc_init(void) // events will be enabled or disabled as needed (such approach is more // energy efficient). nrf_rtc_int_enable(COMMON_RTC_INSTANCE, - #if defined(TARGET_MCU_NRF51822) - OS_TICK_INT_MASK | - #endif #if DEVICE_LOWPOWERTIMER LP_TICKER_INT_MASK | #endif @@ -506,6 +503,7 @@ static void register_next_tick() { int os_tick_init (void) { common_rtc_init(); + nrf_rtc_int_enable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK); nrf_rtc_cc_set(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL, 0); register_next_tick();