Hi all,
I want to measure higher frequency (8 MHz) count/ticks by using the lower frequency (32 KHz) is there is any method to do it or any examples.
I want to measure the count as shown in the figure.
Thanks in advance..
Hi all,
I want to measure higher frequency (8 MHz) count/ticks by using the lower frequency (32 KHz) is there is any method to do it or any examples.
I want to measure the count as shown in the figure.
Thanks in advance..
Thanks for your suggestion. I have edited the code as follows. The code runs in a while(1) loop.
void clock_init(void) { NRF_CLOCK->EVENTS_CTTO=0; NRF_CLOCK->EVENTS_DONE=0; NRF_CLOCK->CTIV=100; NRF_CLOCK->TASKS_CAL=1; printf("task cal %d\n \r", NRF_CLOCK->EVENTS_DONE); nrf_delay_ms(100); printf("task cal %d\n \r", NRF_CLOCK->EVENTS_DONE); // while(NRF_CLOCK->EVENTS_DONE==0) // { // nrf_delay_ms(1); // } NRF_CLOCK->TASKS_CTSTART=1; int i=0; while(!(NRF_CLOCK->EVENTS_CTTO)) { i++; } NRF_CLOCK->TASKS_CTSTOP; printf("Count for CTTO %d \n\r",i); }
Wanted to cofirm if this is what you have suggested. Further i have a few questions:
1) I have given a delay of 100ms for the NRF_CLOCK-> EVENTS_DONE to become one after triggering TASKS_CAL. The code prints the value as 0 before the delay and 1 after the delay. However instead of giving the fixed delay, if i try to implement the same in a while loop (the commented lines in the code), the program stays in the loop forever, giving an impression that the EVENTS_DONE is never becoming 1. Anything wrong with this implementation.
2) I wanted a better clarity about EVENTS_DONE and EVENTS_CTTO. The time required for EVENTS_DONE=1 is the time required for calibration. What exactly the EVENTS_CTTO indicate (is it the period across which the calibration is triggered ??. Does it mean that calibration happens after every CTTO interval, however the actual time for calibration is indicated by EVENTS_DONE flag?).
3) How is the clock for EVENTS_CTTO getting counted. Is it using the low frequency clock (32kHz) or the high frequency clock (16MHz)?
Thanks,