Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

App timer library setup problems

Hello all,

referring to this tutorial https://devzone.nordicsemi.com/guides/short-range-guides/b/software-development-kit/posts/application-timer-tutorial?CommentSortBy=CreatedDate&CommentSortOrder=Descending however, not everything goes smoothly!

Got to the point to compile the library in my project, however, I am stuck with the initialization of the LFCLK. Following the tutorial line by line, however, the LFCLK initialization does not work :/

The error points to the  nrfx_clock_lfclk_start...

Indeed, the library without that line compiles just fine, and the includes seems to be ok. Any ideas what else could be wrong, namely what is missed when looking at the above link, I guess it is not a problem of using a different SDK? For example, the tuturial at hand is based on SDK5 15... while I am on SDK5 ver 17... ?

Best.

  • Hi,

    I guess it is not a problem of using a different SDK?

    It is!

    The blog post was made for an earlier version of the SDK, thus changes to later versions will affect it. Have you enabled the nrfx_clock driver by setting 

    NRFX_CLOCK_ENABLED 1 in the sdk_config.h file?
    regards
    Jared 
  • Hello Jared, 

    was missing this, so I have put the following into the sdk_config.h

    // <e> NRFX_CLOCK_ENABLED - nrfx_clock - CLOCK peripheral driver
    //==========================================================
    #ifndef NRFX_CLOCK_ENABLED
    #define NRFX_CLOCK_ENABLED 1
    #endif
    
    // <o> NRFX_CLOCK_CONFIG_LF_SRC  - LF Clock Source
    
    // <0=> RC 
    // <1=> XTAL 
    // <2=> Synth 
    // <131073=> External Low Swing 
    // <196609=> External Full Swing 
    
    #ifndef NRFX_CLOCK_CONFIG_LF_SRC
    #define NRFX_CLOCK_CONFIG_LF_SRC 1
    #endif
    
    // <o> NRFX_CLOCK_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef NRFX_CLOCK_CONFIG_IRQ_PRIORITY
    #define NRFX_CLOCK_CONFIG_IRQ_PRIORITY 6
    #endif
     

    I guess this is ok now ? Anyway, it compiles with no warnings, however, still getting the error when trying to run the lfclk_request();

    Any ideas how to get around with the SDK that I am using?

    Best. 

  • Hi,

    Are you still getting the same error? Could you try to also add this:

    // <e> NRF_CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver - legacy layer
    //==========================================================
    #ifndef NRF_CLOCK_ENABLED
    #define NRF_CLOCK_ENABLED 1
    #endif
    // <o> CLOCK_CONFIG_LF_SRC  - LF Clock Source
     
    // <0=> RC 
    // <1=> XTAL 
    // <2=> Synth 
    // <131073=> External Low Swing 
    // <196609=> External Full Swing 
    
    #ifndef CLOCK_CONFIG_LF_SRC
    #define CLOCK_CONFIG_LF_SRC 1
    #endif
    
    // <q> CLOCK_CONFIG_LF_CAL_ENABLED  - Calibration enable for LF Clock Source
     
    
    #ifndef CLOCK_CONFIG_LF_CAL_ENABLED
    #define CLOCK_CONFIG_LF_CAL_ENABLED 0
    #endif
    
    // <o> CLOCK_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef CLOCK_CONFIG_IRQ_PRIORITY
    #define CLOCK_CONFIG_IRQ_PRIORITY 6
    #endif
    
    // </e>
    

    App timer source file and path to source file has also been added to the project right?

    regards

    Jared 

  • Hi Jared!

    Added the new line (// <q> CLOCK_CONFIG_LF_CAL_ENABLED  - Calibration enable for LF Clock Source) to the sdk config, however, nothing better, can you say more about the following?

    App timer source file and path to source file has also been added to the project right?

    And this are my includes:

    // app timer library
    #include "nrfx_timer.h"
    #include "bsp.h"
    #include "nrf_drv_timer.h"

    #include "app_timer.h"
    #include "nrf_drv_clock.h"

    So far I have the nrfx_timer.c in the nRF_Drivers folder and app_timer.c in the nRF_Libraries folder.

    Is this ok? 

    Best.

  • What toolchain/IDE are you using? SES? Have you also added the path to the folder containing source, and added the source file as part of the project? See this.

Related