Skip to content

Commit fca16f8

Browse files
authored
Merge pull request #2410 from pan-/fix_nrf51_os_tick
Fix possible overflow of NRF51 os tick.
2 parents 7007c46 + c17be7e commit fca16f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/us_ticker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ static void register_next_tick() {
474474
uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE);
475475

476476
// If an overflow occur, set the next tick in COUNTER + delta clock cycles
477-
if (is_in_wrapped_range(previous_tick_cc_value, new_compare_value, current_counter) == false) {
477+
if (is_in_wrapped_range(previous_tick_cc_value, new_compare_value, current_counter + 1) == false) {
478478
new_compare_value = current_counter + delta;
479479
}
480480
nrf_rtc_cc_set(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL, new_compare_value);

0 commit comments

Comments
 (0)