This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Use lower frequency(32 KHz) to measure higher frequency(8 MHz) ticks/counts for 1 second

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..

Parents
  • Hi,

    There is no count mode on the low frequency timers (RTC), this is only available in the high frequency TIMER peripherals. Also, how should the lower frequency timer be able to count the higher frequency signal? You would lose all the ticks of the high frequency signel that is between each clock cycle of the low frequency timer.

    Best regards,
    Jørgen

  • Please have a look at my answer in this thread.

    You can calibrate the low frequency RC oscillator by triggering the task TASKS_CAL, and calibration can be done at a given interval by setting CTIV, and triggering CT_START task.

  • Hi Jorgen,

    Is this the way to calibrate RC oscillator .

    	NRF_CLOCK->TASKS_HFCLKSTART;
    	//NRF_CLOCK->TASKS_LFCLKSTART;
    	NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos);
    	NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    	NRF_CLOCK->TASKS_LFCLKSTART    = 1;
    	
    	NRF_CLOCK->TASKS_CAL=1;
    	printf("task cal\n \r");
    	printf("ctiv\n\r");
    	NRF_CLOCK->TASKS_CTSTART;
    	NRF_CLOCK->CTIV=10;
    //	NRF_CLOCK->EVENTS_DONE;
    //	NRF_CLOCK->EVENTS_CTTO;
    	NRF_CLOCK->TASKS_CTSTOP;
    
    
    	//nrf_delay_ms(1000);
    	while(NRF_CLOCK->CTIV==0)
    	{
    		nrf_delay_ms(100);
    		printf("Calibrating done\n\r");
    	}
    	printf("Calibration\n\r");

    or i am going in the wrong direction. By using this i am not getting any output. If i am going wrong please tell me where i am going wrong.

    Thank..,

Reply
  • Hi Jorgen,

    Is this the way to calibrate RC oscillator .

    	NRF_CLOCK->TASKS_HFCLKSTART;
    	//NRF_CLOCK->TASKS_LFCLKSTART;
    	NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos);
    	NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    	NRF_CLOCK->TASKS_LFCLKSTART    = 1;
    	
    	NRF_CLOCK->TASKS_CAL=1;
    	printf("task cal\n \r");
    	printf("ctiv\n\r");
    	NRF_CLOCK->TASKS_CTSTART;
    	NRF_CLOCK->CTIV=10;
    //	NRF_CLOCK->EVENTS_DONE;
    //	NRF_CLOCK->EVENTS_CTTO;
    	NRF_CLOCK->TASKS_CTSTOP;
    
    
    	//nrf_delay_ms(1000);
    	while(NRF_CLOCK->CTIV==0)
    	{
    		nrf_delay_ms(100);
    		printf("Calibrating done\n\r");
    	}
    	printf("Calibration\n\r");

    or i am going in the wrong direction. By using this i am not getting any output. If i am going wrong please tell me where i am going wrong.

    Thank..,

Children
No Data
Related