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

Can timers be accessed after advertisement starts?

I am new to nrf52.

I want to configure TIMER1 as a counter.

However it does not count. I have added it after advertisement_init

Does the nrf52 have any such limitations? How to handle them?

Parents Reply Children
  • Raja Sumant said:
    TIMER0-5 mode counter is deprecated? Does that mean we can no longer user TIMER0-5 as a counter?

    No, only the Counter mode is deprecated - this because the LowPowerCounter mode has been added with the nRF52 series.
    You can absolutely use the TIMER0-5 as counters, just use the LowPowerCounter mode.
    You may of course still also use the deprecated Counter mode, but it comes with a higher power consumption.

    Please see this ticket for further detail.

    Best regards,
    Karl



  • Hello Karl. The Timer Driver method fails to work.

    When I use this,
    const nrf_drv_timer_t TIMER_LED = NRF_DRV_TIMER_INSTANCE(3);

    It does not compile. Hence I am working directly with the registers.

  • Hello again,

    Raja Sumant said:
    The Timer Driver method fails to work.

    When I use this,
    const nrf_drv_timer_t TIMER_LED = NRF_DRV_TIMER_INSTANCE(3);

    It does not compile. Hence I am working directly with the registers.

    Are you familiar with the sdk_config.h file and its function?
    The compilation error you receive in your included picture is caused by the particular timer not being enabled in the sdk_config.
    Without seeing your sdk_config.h it is hard to say for certain, but I would guess that some *_TIMER_ENABLED defines are not set.
    Could you check this out for me, and let me know their current value?

    Are you able to run the TIMER example from the SDK that I referenced earlier?
    If you are, you may take a look in its sdk_config file, to see how the TIMER driver is set up there.

    I would highly recommend making use of the drivers and libraries provided in the SDK - sincit will save you a lot of work and fine-reading of the register descriptions.

    Best regards,
    Karl

     




  • Hello. This is how it looks. 

    I am unable to run the timer.

    I was only able to get the RTC counter working.

  • Hi,

    Raja Sumant said:
    This is how it looks. 

    I am unable to run the timer.

    Thank you for clarifying on this. From these lines, it seems that you have indeed not enabled the timers.
    So, if you are using the NRFX_TIMER driver, you will need to enable it in the sdk_config ( NRFX_TIMER_ENABLED 1 ), along with the particular timer instances you are intending to use ( NRFX_TIMER3_ENABLED 1 ). If you are using NRFX_DRIVER you will need to remove the legacy NRF_DRV_TIMER_* defines from your sdk_config file. If you are using the legacy nrf_drv_timer driver, then you will need to set their ENABLED's.
    Please do this, and let me know if you are able to use the timer drivers following this.

    For future reference, it is always easiest if you share code using the "Insert -> code" option, instead of including screenshots. Screenshots often does not contain all the right information.

    Best regards,
    Karl

Related