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

[NRF52832][SDK 14.0][Keil] Hardware UART + Ble compilation issue

Hi,

Trying to implement a simple Hardware UART in parrallel with Ble on a custom board with mdbt42 Raytac module. I have the following compilation error:

*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'C:\Program Files (x86)\Keil\ARM\ARMCC\Bin'
Build target 'nrf52832_xxaa'
compiling main.c...
linking...
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol app_uart_init (referred from main.o).
.\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol app_uart_put (referred from main.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 2 error messages.
".\_build\nrf52832_xxaa.axf" - 2 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:04

I tried a lot of things including to add corresponding source file to project and add folder path to compiler. Ble beacon project and UART peripheral project works well separatly. I often have difficult to merge projects using softdevice and projects without.

Does someone can help figuring out what wrong ?

Bellow the source code:

#include <stdbool.h>
#include <stdint.h>
#include "nordic_common.h"
#include "nrf_soc.h"
#include "nrf_sdh.h"
#include "nrf_sdh_ble.h"
#include "nrf_delay.h"
#include "ble_advdata.h"
#include "app_uart.h"
#include "app_timer.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "nrf_gpio.h"

uint32_t err_code;
uint8_t cr = 'a';

const app_uart_comm_params_t comm_params =
      {
          17,
          16,
          NULL,
          NULL,
          APP_UART_FLOW_CONTROL_DISABLED,
          false,
          UART_BAUDRATE_BAUDRATE_Baud115200
      };
			

int main(void)
{
    // Initialize.
		nrf_gpio_cfg_output(25);
		nrf_gpio_cfg_output(26);
		nrf_gpio_cfg_output(27);
	
		APP_UART_INIT(&comm_params,
                         NULL,
                         APP_IRQ_PRIORITY_LOWEST,
                         err_code);
	
    for (;; )
    {
				nrf_gpio_pin_toggle(25);
				nrf_gpio_pin_toggle(26);
				nrf_gpio_pin_toggle(27);
				app_uart_put(cr);
				nrf_delay_ms(1000);
    }
}

Alexander

  • And you still have the source file (app_uart.c or app_uart_fifo.c) included in your project?

  • I assumed to have added the file but no.. Now the error look like this:

    *** Using Compiler 'V5.06 update 4 (build 422)', folder: 'C:\Program Files (x86)\Keil\ARM\ARMCC\Bin'
    Build target 'nrf52832_xxaa'
    compiling app_uart.c...
    ..\..\..\..\..\..\components\libraries\uart\app_uart.c(50): error:  #20: identifier "UART1_CONFIG_USE_EASY_DMA" is undefined
      static nrf_drv_uart_t app_uart_inst = 
    RF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);
    ..\..\..\..\..\..\components\libraries\uart\app_uart.c(50): error:  #20: identifier "NRF_UARTE1" is undefined
      static nrf_drv_uart_t app_uart_inst = 
    RF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);
    ..\..\..\..\..\..\components\libraries\uart\app_uart.c(50): error:  #44: expression must have pointer type
      static nrf_drv_uart_t app_uart_inst = 
    RF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);
    ..\..\..\..\..\..\components\libraries\uart\app_uart.c(50): error:  #44: expression must have pointer type
      static nrf_drv_uart_t app_uart_inst = 
    RF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);
    ..\..\..\..\..\..\components\libraries\uart\app_uart.c(50): error:  #44: expression must have pointer type
      static nrf_drv_uart_t app_uart_inst = 
    RF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);
    ..\..\..\..\..\..\components\libraries\uart\app_uart.c: 0 warnings, 5 errors
    ".\_build\nrf52832_xxaa.axf" - 5 Error(s), 0 Warning(s).
    Target not created.
    Build Time Elapsed:  00:00:01
    
  • Try changing the APP_UART_DRIVER_INSTANCE to 0, nRF52832 have only 1 UART peripheral (UART0), and it cannot use instance 1. Only nRF52840 IC support UART1 instance.

    #define APP_UART_DRIVER_INSTANCE 0
    
  • Success !!

    Now compilation work well. But still a little bit confused on how to use the SDK. :s

    Thanks a lot Jorgen

  • Great to hear you figured it out. I've found that most errors I get like this (i.e. linker) are due to not having the sdk_config.h file set correctly or missing library source files. You will have to be patient with the SDK, and be prepared for much frustration. It's very poorly documented and keeps changing all the time!

Related