How many system ticks mean 1ms?

Hi,

     I need to use system tick to do some math calculate. So I create a new function to get systick like as below. then I can get some number.

uint32_t nrf_drv_systick_get_for_cadence()
{
    return nrf_systick_val_get();
}

And I create a 200ms timer to get systick every 200ms. like as below

static void data_process_handler(void * p_context)
{ 
    uint32_t time_diff;
    
    time_diff = nrf_drv_systick_get_for_cadence();
    printf("%d\r\n",time_diff);
}

In my understanding, 52832 cpu frequency is fixed on 64MHz. So I refer to below function. I guess 64000 systick is mean "1ms"

So if I printf systick result every 200ms, I think that the result is always increase 64000 * 200 = 12800000

static inline uint32_t nrf_drv_systick_ms_tick(uint32_t ms)
{
    return ms * ((SystemCoreClock) / NRF_DRV_SYSTICK_MS);
}
 

But the result is not my imagination.

31298
4007830
7984375
11960898
15937430
3136746
7113278
11089819
15066342
2265658
6242190
10218722
14195271
1394570
5371102
9347634
13324166
523499
4500014
8476546
12453078

So My question is how many system ticks mean "1ms"? Is there anything I misunderstood?

Thank you.

John.

Parents
  • Hi,

           Add a bit of information.

    1. Based on my result. sound like 19885 systicks mean "1ms"

    2. I don't use nrf_pwr_mgmt_run()

    void main()
    {
        for (;;)
        {
            if (m_saadc_calibrate == true) 
            {
                nrf_drv_saadc_abort();
                while(nrf_drv_saadc_calibrate_offset() != NRF_SUCCESS); //Trigger calibration task
                m_saadc_calibrate = false;
            }
            //nrf_pwr_mgmt_run();
        }
    }

Reply
  • Hi,

           Add a bit of information.

    1. Based on my result. sound like 19885 systicks mean "1ms"

    2. I don't use nrf_pwr_mgmt_run()

    void main()
    {
        for (;;)
        {
            if (m_saadc_calibrate == true) 
            {
                nrf_drv_saadc_abort();
                while(nrf_drv_saadc_calibrate_offset() != NRF_SUCCESS); //Trigger calibration task
                m_saadc_calibrate = false;
            }
            //nrf_pwr_mgmt_run();
        }
    }

Children
No Data
Related