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

"CLOCK_CONFIG_XTAL_FREQ" is undefined

Hello,

I am trying to configure my NRF52 dev kit (PCA 10040) to work with pwm using the build-in timer. I used some code from the low_power_pwm example but when I am using it in my code with the libraries included I get these 3 errors:

identifier "CLOCK_CONFIG_XTAL_FREQ" is undefined nrf_clock_xtalfreq_set(CLOCK_CONFIG_XTAL_FREQ); identifier "CLOCK_CONFIG_LF_SRC" is undefined nrf_clock_lf_src_set((nrf_clock_lf_src_t)CLOCK_CONFIG_LF_SRC); identifier "CLOCK_CONFIG_IRQ_PRIORITY" is undefined

I have included the same libraries and drivers from the example into my code (except for nrf_nvic.c) but it still gives me these errors. Also I am using the debug out pins if that helps. Any advice? Thanks.

  • Hello Hanan,

    Not sure which template project you are using now, but maybe you can check the config file "nrf_drv_config.h" in your current project to see if the "CLOCK_ENABLE" has been turning on. By reference the "nrf_drv_config.h" in the "low_power_pwm" project:

    /* CLOCK */
    #define CLOCK_ENABLED 1
    
    #if (CLOCK_ENABLED == 1)
    #define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
    #define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
    #define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
    #endif
    

    Seem the compile error you mentioned are all from here, and may cause by undefining the "CLOCK_ENABLE = 1". Hope the upon description can help you : )

Related