drivers: nrf_rtc_timer: Correct initial timeout value
Values to be set to the comparator need to be specified in RTC cycles, not ticks, so the initial value used in the tickless mode needs to be MAX_CYCLES, otherwise when CONFIG_SYS_CLOCK_TICKS_PER_SEC is set to a value less then the RTC frequency, the initially configured timeout will be unnecessarily shorter. On the occassion, remove also the call to counter() when setting the initial timeout value in non-tickless mode. RTC is cleared a few lines above, so at this point it will most likely be 0, and even if it was not, compare_set() would properly handle a target time value that had already passed. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
3ffaaa989a
commit
eb0cbb433c
1 changed files with 1 additions and 1 deletions
|
@ -670,7 +670,7 @@ static int sys_clock_driver_init(const struct device *dev)
|
|||
}
|
||||
|
||||
uint32_t initial_timeout = IS_ENABLED(CONFIG_TICKLESS_KERNEL) ?
|
||||
MAX_TICKS : (counter() + CYC_PER_TICK);
|
||||
MAX_CYCLES : CYC_PER_TICK;
|
||||
|
||||
compare_set(0, initial_timeout, sys_clock_timeout_handler, NULL);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue