Is it possible to directly read the timer module counter register in the nRF51?
Is it possible to directly read the timer module counter register in the nRF51?
RTC Counter you CAN read directly, You CANNOT read TIMER counter directly. You need to capture it into one compare register.
If you are using SDK timer driver
uint32_t captured_value = current_nrf_drv_timer_capture(instance, cc_channel);
If you are not using driver, then
NRF_TIMERX->TASKS_CAPTURE[channel_number] = 1;
uint32_t captured_value = NRF_TIMERx->CC[cc_channel];
@Note: Capturing into CC register means that previous values in those registers are lost. If your application is waiting for some events based on previous values, then your app will malfunction. Capture only into a free CC register.
Thanks Aryan. Can you give me an idea of the delay (number of clock cycles) in "capturing" the counter?
Marshall.
This is internal to peripheral so It should be not be more than one system clock cycle.
Hi
can any one tell me how to read counter register value of real time counter example of nrf51?