I'm trying to use the RTC0 instance of an nrf52840 controller with a prescaler of 3277 so that its counter increments at a rate of approx. 10ms. Since I use Zephyr (SDK2.5.2) I defined the rtc0 in the device tree with the following lines:
In the c-file I get the rtc0 instance and simply start the counter. Using ksleep I implemented a loop that prints the rtc0 counter value every second:
The output on UART is as follows:
16:07:59:615 -> [00:00:01.119,354] <inf> resettable_rtc: Current ticks: 36679
16:08:00:622 -> [00:00:02.125,518] <inf> resettable_rtc: Current ticks: 69649
16:08:01:629 -> [00:00:03.131,683] <inf> resettable_rtc: Current ticks: 102619
16:08:02:636 -> [00:00:04.137,908] <inf> resettable_rtc: Current ticks: 135591
The rtc_value inceases by 36679 within 1.119354 seconds. I.e., the counter increases at a frequency of 32768Hz. This is actually the RTC clock without a prescaler. When having a look at the Peripherial View in VS Code's nRF Connect extension the RTC0 prescaler is also 0.
So my quesion is: Where is my fault? Where to set the prescaler of RTC0 accordingly when the device-tree setting has no effect?
Many thanks for any hints given!