This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to get RTC1 counter value during runtime

USING RTC1 for app timer library.

Using windows 10 OS, and SES v5.40.

I am using nRF52833 device in my project along with nRF5_SDK_for_Thread_and Zigbee_v4.1.0_32ce5f8 SDK. There is RTC0

Trying to get RTC 1 counts through this library function TIMEAPI_RtcGetCounter_U32() this function which returns 0 always. 

in turn debugging further app_timer_cnt_get() function returns 0 and also rtc1_counter_get() returns zero.

Also i see even NRF_RTC1->COUNTER value is zero always 

and if i pause my debugging session the counter in RTC1 will always have some value.

According to my knowledge counter should be running as per the code, and it should have some value all the time, COUNTER in watch is always 0.

Please suggest some right way to get the RTC1 counter value.

  • Hi

    RTC1 is used in the app_timer library by default. To prevent it from being compiled/linked you need to remove the source file (app_timer.c) from your project or disable app_timer in your sdk_config.h file.

    // <e> APP_TIMER_ENABLED - app_timer - Application timer functionality
    //==========================================================
    #ifndef APP_TIMER_ENABLED
    #define APP_TIMER_ENABLED 0
    #endif

    Please note that the app_timer might be used by other library modules in your app/example, but then you'll get undefined reference errors when trying to remove it.

    Best regards,

    Simon

  • Hi simonr,

    We are able to include app_timer2.c(newer version) to the project and now the problem that we had is solved and also got to know that RTC1 is automatically controlled using app timer itself and no need to enable in SDK_config.h..

    But still i dont get one thing :

    1. Dont we have any real time feature in SES to watch which periphers are currently active.

    2. The current registers view can only show the state of peripherals only when halted.

    I want to know this because we are working around the power measurements, and we see that some process in ADC or comparator is running even during sleep(system on mode) need to see which peripheral is creating that issue.

    Best regards

    Abhijith

  • Hi

    Glad to hear you resolved the initial issue.

    Unfortunately, the only way to see if individual peripheral is active is to see its register, and for the debugger to read the peripheral register it needs to halt the CPU. A power analyzer or the clock can be used to give overall information, but not information on which specific peripherals are on.

    You could possibly create a polling function that could print some of the peripheral registers, for debugging purposes.

    Best regards,

    Simon

  • Hi Simonr,

    Thanks for your reply on this.

    Yes we could print the peripheral registers creating a loop. and i also found some feature where we could force view the value of specific register using a breakpoint and then stepping over the particular instruction also gives the real time value of that register.

    Best Regards

    Abhijith Desai

Related