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

Error: L6218E: Undefined symbol when follow the tutorial

Hi All

I am doing a project which is base on SDK15.2  examples\proprietary_rf\gzll\gzp_dynamic_pairing\host\pca10040\blank\arm5_no_packs

I would like to add a timer to this project

so i search some answer here, and i found the tutorial

I do what the tutorial said step by step

but after I add the function lfclk_request();

and call in the main()

the compile result show the error below:

.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrf_drv_clock_init (referred from main.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrf_drv_clock_lfclk_request (referred from main.o).

but actually i have already include the nrf_drv_clock.h and app_timer.h which the tutorial said

did i lost something important before i compile the project?

can anyone tell me what should i do?

  • Hi,

    You get the error either because you have not included nrf_drv_clock.c in your application or because you have not set NRF_CLOCK to 1 in the projects sdk_config.h. This is not described in the tutorial, as it is already present in the example project and most existing applications. (Note that this is not necessary if you are trying to add the app_timer in an existing project where the 32 kHz clock is already running, either because it was started by the SoftDevice or it was started explicitly.)

  • Hi Einar

    What should I do if I can't see NRF_CLOCK in the projects sdk_config.h? 
    I try to add the definition which i don't define in my project but define in the tutorial project, but it comes to more errors.

    What do you mean to include nrf_drv_clock.c to my project?
    Do you mean i also have to #include "nrf_drv_clock.c" in main.c?

  • Hi,

    Johnson Hirota said:
    What should I do if I can't see NRF_CLOCK in the projects sdk_config.h? 
    I try to add the definition which i don't define in my project but define in the tutorial project, but it comes to more errors.

    You can copy the clock settings from another projects sdk_config.h file. You should use something like this (note that there was a typy on my previous reply, where the _ENABLED suffix was missing from the define):

    // <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
    
    // <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>

    Johnson Hirota said:
    What do you mean to include nrf_drv_clock.c to my project?
    Do you mean i also have to #include "nrf_drv_clock.c" in main.c?

    No, I just mean that nrf_drv_clock.c must be included/added to the project so that it is compiled like any other .c file in your project.

Related