Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

adding ble app uart into a peripheral example

Hi,

I am trying to add the ble-app-uart example into the saadc example. I added all needed files.c which there were not in the saadc project and also all paths in the user include path in the project option. I also added all #include needed for the uart example in the main.c file of the saadc project.

I faced a lot of errors such as:

error: 'NRF_SDH_BLE_TOTAL_LINK_COUNT' undeclared here (not in a function); did you mean 'NRF_BLE_GATT_LINK_COUNT

and

error: 'BLE_NUS_BLE_OBSERVER_PRIO' undeclared here (not in a function); did you mean 'APP_BLE_OBSERVER_PRIO'?

and so on...

I tried to add codes into the sdk_config.c to eliminate the errors. But it seems that this is not the correct way.

Could you please help me?

Thank you,

Sama

  • Hi Sama,

    There are two possible issue while merging two sample projects.

    1. sdk_config.h flags are not present or enable

    - Try to compare the sdk_config.h files of both the projects and add the missing flags. Once compared and updated all the configurations from ble-app-uart example into the saadc example check if errors are reduced.

    2. Library path is not added into build configuration

    - Fir that compare library paths and add if absent

     In my experience it is always easy to add code from peripheral examples into ble examples. If nothing is working try to add code from saadc example into ble-app-uart example, very less configuration is required in project to add peripherals.

    Regards

  • Yes, I highly agree. Merging the peripheral examples into the BLE examples is the recommended approach. Also if you're looking for an example that includes ble_app_uart and SAADC then you can find it here.

  • Hi

    Thank you for your reply.

    I compared the sdk_config.h files of both the projects and added every line which there is not in the sdk_config of SADDC.

    I compared the flash placement file and found that something there is not in the flash placement of the SADDC project, so I added them. 

    the number of errors reduced but finally, I faced with these errors:

    Output/Release/Obj/saadc_pca10056/main.o: in function `ble_evt_handler':

    this is the log:

     Rebuilding ‘saadc_pca10056’ from solution ‘saadc_pca10056’ in configuration ‘Release’
    1> Assembling ‘thumb_crt0.s’
    2> Compiling ‘nrf_log_backend_rtt.c’
    3> Compiling ‘nrf_log_backend_serial.c’
    4> Compiling ‘nrf_log_backend_uart.c’
    1> Compiling ‘nrf_log_default_backends.c’
    2> Compiling ‘nrf_log_frontend.c’
    3> Compiling ‘nrf_log_str_formatter.c’
    4> Compiling ‘app_error.c’
    1> Compiling ‘app_error_handler_gcc.c’
    4> Compiling ‘app_error_weak.c’
    3> Compiling ‘app_util_platform.c’
    2> Compiling ‘nrf_assert.c’
    1> Compiling ‘nrf_atomic.c’
    4> Compiling ‘nrf_balloc.c’
    2> Compiling ‘nrf_fprintf.c’
    3> Compiling ‘nrf_fprintf_format.c’
    1> Compiling ‘nrf_memobj.c’
    4> Compiling ‘nrf_pwr_mgmt.c’
    2> Compiling ‘nrf_ringbuf.c’
    3> Compiling ‘nrf_section_iter.c’
    1> Compiling ‘nrf_strerror.c’
    4> Compiling ‘nrf_drv_ppi.c’
    2> Compiling ‘nrf_drv_uart.c’
    3> Compiling ‘nrfx_atomic.c’
    1> Compiling ‘nrfx_ppi.c’
    4> Compiling ‘nrfx_prs.c’
    2> Compiling ‘nrfx_saadc.c’
    3> Compiling ‘nrfx_timer.c’
    4> Compiling ‘nrfx_uart.c’
    1> Compiling ‘nrfx_uarte.c’
    2> Compiling ‘main.c’
    3> Compiling ‘SEGGER_RTT.c’
    2> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\main.c:147:1: warning: data definition has no type or storage class
    2> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\main.c:147:1: warning: type defaults to 'int' in declaration of 'Max_Sample' [-Wimplicit-int]
    1> Compiling ‘SEGGER_RTT_Syscalls_SES.c’
    4> Compiling ‘SEGGER_RTT_printf.c’
    1> Assembling ‘ses_startup_nrf52840.s’
    1> Assembling ‘ses_startup_nrf_common.s’
    2> Compiling ‘system_nrf52840.c’
    4> Compiling ‘Calculate_param.c’
    1> Compiling ‘calculate_cross_zero.c’
    3> Compiling ‘Wave1_Calculations.c’
    4> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Calculate_param.c:59:8: warning: implicit declaration of function 'SeprateVoltage' [-Wimplicit-function-declaration]
    4> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Calculate_param.c:82:3: warning: implicit declaration of function 'Wave1_Calculations' [-Wimplicit-function-declaration]
    4> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Calculate_param.c:84:4: warning: implicit declaration of function 'Wave2_Calculations' [-Wimplicit-function-declaration]
    4> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Calculate_param.c:86:2: warning: implicit declaration of function 'Wave3_Calculations' [-Wimplicit-function-declaration]
    4> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Calculate_param.c:88:3: warning: implicit declaration of function 'Wave4_Calculations' [-Wimplicit-function-declaration]
    3> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave1_Calculations.c:54:3: warning: implicit declaration of function 'SeprateCurrent' [-Wimplicit-function-declaration]
    3> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave1_Calculations.c:55:3: warning: implicit declaration of function 'Calculate_VRMS_IRMS' [-Wimplicit-function-declaration]
    3> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave1_Calculations.c:116:6: warning: conflicting types for 'SeprateCurrent'
    3> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave1_Calculations.c:54:3: note: previous implicit declaration of 'SeprateCurrent' was here
    4> Compiling ‘calculate_VRMS_IRMS.c’
    1> Compiling ‘Wave2_Calculations.c’
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave2_Calculations.c:22:7: warning: implicit declaration of function 'SeprateVoltage' [-Wimplicit-function-declaration]
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave2_Calculations.c:23:7: warning: implicit declaration of function 'SeprateCurrent' [-Wimplicit-function-declaration]
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave2_Calculations.c:24:7: warning: implicit declaration of function 'Calculate_VRMS_IRMS' [-Wimplicit-function-declaration]
    3> Compiling ‘Wave3_Calculations.c’
    1> Compiling ‘Wave4_Calculations.c’
    3> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave3_Calculations.c:20:7: warning: implicit declaration of function 'SeprateVoltage' [-Wimplicit-function-declaration]
    3> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave3_Calculations.c:21:7: warning: implicit declaration of function 'SeprateCurrent' [-Wimplicit-function-declaration]
    3> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave3_Calculations.c:22:7: warning: implicit declaration of function 'Calculate_VRMS_IRMS' [-Wimplicit-function-declaration]
    2> Compiling ‘match.c’
    4> Compiling ‘bsp.c’
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave4_Calculations.c:24:7: warning: implicit declaration of function 'SeprateVoltage' [-Wimplicit-function-declaration]
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave4_Calculations.c:25:7: warning: implicit declaration of function 'SeprateCurrent' [-Wimplicit-function-declaration]
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses\calculation\Wave4_Calculations.c:26:7: warning: implicit declaration of function 'Calculate_VRMS_IRMS' [-Wimplicit-function-declaration]
    3> Compiling ‘bsp_btn_ble.c’
    1> Compiling ‘ble_advdata.c’
    4> Compiling ‘ble_conn_params.c’
    2> Compiling ‘ble_conn_state.c’
    3> Compiling ‘ble_srv_common.c’
    1> Compiling ‘ble_advertising.c’
    4> Compiling ‘ble_link_ctx_manager.c’
    2> Compiling ‘nrf_ble_gatt.c’
    3> Compiling ‘nrf_ble_qwr.c’
    1> Compiling ‘ble_nus.c’
    4> Compiling ‘utf.c’
    2> Compiling ‘nrfx_gpiote.c’
    3> Compiling ‘nrf_drv_clock.c’
    4> Compiling ‘nrfx_clock.c’
    1> Compiling ‘app_button.c’
    3> Compiling ‘app_fifo.c’
    4> Compiling ‘app_scheduler.c’
    2> Compiling ‘app_timer2.c’
    1> Compiling ‘app_uart_fifo.c’
    4> Compiling ‘drv_rtc.c’
    3> Compiling ‘hardfault_implementation.c’
    2> Compiling ‘nrf_atfifo.c’
    1> Compiling ‘nrf_atflags.c’
    3> Compiling ‘nrf_sortlist.c’
    4> Compiling ‘retarget.c’
    2> Compiling ‘nrf_sdh_ble.c’
    1> Compiling ‘nrf_sdh_soc.c’
    3> Compiling ‘nrf_sdh.c’
    4> Compiling ‘boards.c’
    1> Generating linker script ‘saadc_pca10056.ld’
    1> Linking saadc_pca10056.elf
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o: in function `ble_evt_handler':
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:507: undefined reference to `nrf_ble_qwr_conn_handle_assign'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o: in function `bsp_event_handler':
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:641: undefined reference to `ble_advertising_restart_without_whitelist'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o: in function `gatt_init':
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:609: undefined reference to `nrf_ble_gatt_init'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:612: undefined reference to `nrf_ble_gatt_att_mtu_periph_set'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o: in function `services_init':
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:378: undefined reference to `nrf_ble_qwr_init'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o: in function `advertising_init':
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:768: undefined reference to `ble_advertising_init'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:771: undefined reference to `ble_advertising_conn_cfg_tag_set'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o: in function `conn_params_init':
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:442: undefined reference to `ble_conn_params_init'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o: in function `advertising_start':
    1> D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:831: undefined reference to `ble_advertising_start'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o:D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:134: undefined reference to `ble_advertising_on_ble_evt'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o:D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:132: undefined reference to `nrf_ble_gatt_on_ble_evt'
    1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.34/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/saadc_pca10056/main.o:D:\Behine Niroo\Nordic\nRF5_SDK_17.0.2_d674dde\examples\peripheral\SAADC.V1.7.0.13991203 - Test for adding ble-uart\pca10056\blank\ses/main.c:133: undefined reference to `nrf_ble_qwr_on_ble_evt'
    Build failed

    Is there any solution?

    I have to add UART to SAADC as my boss wants.

    I have wasted a great deal of time to do this task.

    Please help.

    thanks,

    Sama

  • Hi,

    Thank you for your reply.

    I have to do this on my own and I want to learn how to modify different examples.

    Thanks,

    Sama

  • Are you following our advice of merging SAADC into the BLE example? Also, you have to make sure to also add the path of the folder where the source files are located, see this

Related