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

Error: L6218E

I am running into these 3 errors while compiling my program. I tried fixing sdk_config.h.

.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol app_uart_init (referred from main.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrfx_twim_enable (referred from main.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol nrfx_twim_rx (referred from main.o).

Am I still missing anything else in sdk_config.h to make it work?

  • Hi,

    I was not talking about the NRFX_TWI* defines, but the set of legacy layer TWI* defines. Have a look at the sdk_config.h file from a twi example in the SDK (you find them under <sdk folder>/examples/peripheral). There are many defines, such as TWI_ENABLED, TWI0_ENABLED, TWIM_ENABLED, TWIM0_ENABLED, TWIM1_ENABLED, etc. You may need to set both the NRFX_TWI* define and the corresponding TWI* define in sdk_config.h, in order not to get any trouble. If those defines are missing from your sdk_config.h file then you need to copy them (for instance from the sdk_config.h file of one of the twi examples.)

    Please also have a look at the comment from regarding .c source files. Are they all added to the project?

    Regards,
    Terje

  • I have added these defines but it did not help with the "Undefined symbol nrfx_twim_enable" error.

    // <e> TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver - legacy layer
    //==========================================================
    #ifndef TWI_ENABLED
    #define TWI_ENABLED 1
    #endif
    // <o> TWI_DEFAULT_CONFIG_FREQUENCY  - Frequency
     
    // <26738688=> 100k 
    // <67108864=> 250k 
    // <104857600=> 400k 
    
    #ifndef TWI_DEFAULT_CONFIG_FREQUENCY
    #define TWI_DEFAULT_CONFIG_FREQUENCY 26738688
    #endif
    
    // <q> TWI_DEFAULT_CONFIG_CLR_BUS_INIT  - Enables bus clearing procedure during init
     
    
    #ifndef TWI_DEFAULT_CONFIG_CLR_BUS_INIT
    #define TWI_DEFAULT_CONFIG_CLR_BUS_INIT 0
    #endif
    
    // <q> TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT  - Enables bus holding after uninit
     
    
    #ifndef TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT
    #define TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0
    #endif
    
    // <o> TWI_DEFAULT_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 TWI_DEFAULT_CONFIG_IRQ_PRIORITY
    #define TWI_DEFAULT_CONFIG_IRQ_PRIORITY 6
    #endif
    
    // <e> TWI0_ENABLED - Enable TWI0 instance
    //==========================================================
    #ifndef TWI0_ENABLED
    #define TWI0_ENABLED 1
    #endif
    // <q> TWI0_USE_EASY_DMA  - Use EasyDMA (if present)
     
    
    #ifndef TWI0_USE_EASY_DMA
    #define TWI0_USE_EASY_DMA 1
    #endif
    
    // </e>
    
    // <e> TWI1_ENABLED - Enable TWI1 instance
    //==========================================================
    #ifndef TWI1_ENABLED
    #define TWI1_ENABLED 0
    #endif
    // <q> TWI1_USE_EASY_DMA  - Use EasyDMA (if present)
     
    
    #ifndef TWI1_USE_EASY_DMA
    #define TWI1_USE_EASY_DMA 0
    #endif
    

    I have also added the .c files but did not solve the "app_uart_init" error.

    Thank you!

  • Hi,

    Sorry for the delay.

    In your screenshot I do not see the file nrfx_twim.c in the project. That file is where nrfx_twim_enable is implemented.

    What error messages (if any) do you get now? (After adding nrfx_twim.c if missing.)

    Regards,
    Terje

  • Thank you very much! The error is now solved! I'm left with the "undefined reference to `app_uart_init'" now.

  • In your screenshot, the 'code' column next to app_uart.c is empty.

    This means there is no code for it - which explains the error.

    See: https://devzone.nordicsemi.com/f/nordic-q-a/39798/undefined-reference-to-ble_conn_params_init/154441#154441

Related