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

NRF52832 nrfx_timer can not reach the accuracy of microsecond?

Hi gays,

               Now, I want to collect a pulse waveform(example : 1s, 50% duty cycle ) which accuracy requires milliseconds resolution and I use PPI to read a capture value from timer,but  I see the accuracy drifting. The problem is that i can not reach the accuracy of microsecond resolution.

      Timer Setup:                  

                                nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;  //  16MHZ 
                                timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;
                                timer_cfg.mode = NRF_TIMER_MODE_TIMER;

                               err_code = nrf_drv_timer_init(&timer, &timer_cfg, my_timer_handler);                   

     GPIOTE Setup :

                            err_code = nrf_drv_gpiote_in_init(GPIOTE_CHECK_PIN, &in_config, gpio_intterup1t_handler);   //  capture time value in gpio handler                                              

         PPI Setup:                  

                            gpiote_event_addr = nrf_drv_gpiote_in_event_addr_get(GPIOTE_CHECK_PIN);
                            timer_capture_task_addr = nrf_drv_timer_capture_task_address_get(&timer, (nrf_timer_cc_channel_t)0);

                            err_code = nrf_drv_ppi_channel_assign(ppi_channel, gpiote_event_addr, timer_capture_task_addr);
                            APP_ERROR_CHECK(err_code);

              So, how to improve  the accuracy of nrf_drv_timer?