Skip to content
Browse files

drivers: counter: nrfx_rtc: Fix lack of interrupt when CC=0

According to documentation Compare event will not be triggered
if CC=0 and CLEAR task is set. Added handling of that situation.

Signed-off-by: Krzysztof Chruscinski <>
  • Loading branch information...
nordic-krch authored and galak committed Apr 15, 2019
1 parent 431c450 commit 3a6c786c561c0992d2d6e71b3c261b81772302f7
Showing with 9 additions and 0 deletions.
  1. +9 −0 drivers/counter/counter_nrfx_rtc.c
@@ -99,6 +99,15 @@ static int counter_nrfx_set_alarm(struct device *dev, u8_t chan_id,
nrfx_config->ch_data[chan_id].callback = alarm_cfg->callback;
nrfx_config->ch_data[chan_id].user_data = alarm_cfg->user_data;

if ((cc_val == 0) &&
(get_dev_data(dev)->top != counter_get_max_top_value(dev))) {
/* From Product Specification: If a CC register value is 0 when
* a CLEAR task is set, this will not trigger a COMPARE event.
"Attempt to set CC to 0, delayed to 1.");
nrfx_rtc_cc_set(rtc, ID_TO_CC(chan_id), cc_val, true);

return 0;

0 comments on commit 3a6c786

Please sign in to comment.
You can’t perform that action at this time.