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

Is there possible to get timer period shorter than 12us with nRF51 and SDK 14?

Is there possible to get timer period shorter than 12us with nRF51 and SDK 14?
"timer" example with PCA10040 works correct, but with PCA10028 not.
When set timer period lower than 12us it not corresponds to settings any more.

My code to start timer is following:

const nrf_drv_timer_t TIMER_LED = NRF_DRV_TIMER_INSTANCE(1);

void timer_led_event_handler(nrf_timer_event_t event_type, void* p_context)
{
    nrf_gpio_pin_toggle(LED_3);
}

void timer_start(void)
{
    nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
    uint32_t err_code = nrf_drv_timer_init(&TIMER_LED, &timer_cfg, timer_led_event_handler);
    APP_ERROR_CHECK(err_code);

    uint32_t time_ticks;
    time_ticks = nrf_drv_timer_us_to_ticks(&TIMER_LED, 5);

    nrf_drv_timer_extended_compare(
         &TIMER_LED, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);

    nrf_drv_timer_enable(&TIMER_LED);

}

It gives following result

Period grater than 12us works correct (corresponds to plot).

Parents
  • Hello,

    There are no examples for the pca10028 in SDK14. The latest SDK that supports the nRF52 DK is SDK 12.3.0. Can you try to download the SDK12.3.0 (here) , and try one of the examples marked with "pca10028"?

    e.g. the example:

    SDK12.3.0\examples\peripheral\timer\pca10028\blank\...

     

    Best regards,

    Edvin

  • Hi Edvin,
    downloaded SDK 12.3.0, compared examples and they are identical. Going forward, compiled example for pca10028:
    nRF5_SDK_12.3.0_d7731ad\examples\peripheral\timer\pca10028\blank\armgcc
    Changed only nrf_drv_timer_ms_to_ticks -> nrf_drv_timer_us_to_ticks and timer handler to toggle single GPIO.
    Minimum period to achieve is 8.5us, even if set:
    time_ticks = nrf_drv_timer_us_to_ticks(&TIMER_LED, 1);

    Is possible to achieve higher frequency (I need period 5us)?

Reply
  • Hi Edvin,
    downloaded SDK 12.3.0, compared examples and they are identical. Going forward, compiled example for pca10028:
    nRF5_SDK_12.3.0_d7731ad\examples\peripheral\timer\pca10028\blank\armgcc
    Changed only nrf_drv_timer_ms_to_ticks -> nrf_drv_timer_us_to_ticks and timer handler to toggle single GPIO.
    Minimum period to achieve is 8.5us, even if set:
    time_ticks = nrf_drv_timer_us_to_ticks(&TIMER_LED, 1);

    Is possible to achieve higher frequency (I need period 5us)?

Children
No Data
Related