BLE communication between a nRF52 DK board and a nRF9160 DK board

I am running V2.5.0 SDK. I have a nRF52 DK board that is running the V2.5.0/nrf/samples/Bluetooth/peripheral_uart application. It is working beautifully. I have nRF Toolbox installed on my iPhone. I can connect to the nRF52 DK Bluetooth running the NUS UART service. I can send text strings back and forth from my iPhone to the nrf52DK baord. We have been using the nRF9160 processor for years and we are very comfortable with its operation. We have never used the Bluetooth feature on the nRF9160. I have a nRF9160 dk board that I would like to implement the NUS UART Bluetooth connection like I have running with the iPhone using nRF Toolbox. I want an application on the nRF9160 to search for BLE devices advertising the UART service. I want to connect to that BLE device and be able to send text string back and forth like I can do on my iPhone. I tried the "Bluetooth central UART" but it does not support the nRF9160 as a valid board.

what do I need to do to implement a simple BLE connection between the nRF52DK and the nRF9160DK so I can send text strings back and forth simulating a UART.I have not used any BLE functions until we received the nrf52DK board. I am sure it is operator error. Our application depends on the BLE capability to talk between an nRF52 and a nRF9160. any help would be greatly appreciated.

Parents
  • Hello,

    Attached is a modified version of the Central UART sample, which you can program to the nRF9160 on the nRF9160 DK (use the 'nrf9160dk_nrf9160_ns' build target). You can see the changes I made in the 'changes.diff' file bundled with the zip. It was mostly just copy-and-paste from the Cellular: LTE Sensor Gateway sample.

    Attachment (tested with SDK v.2.5.0)

    6431.central_uart.zip

    Best regards,

    Vidar

    Edit: forgot to add that you need to program the LP HCI UART sample to the nRF52840 on the board for BLE connectivity: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.0/nrf/samples/cellular/lte_ble_gateway/README.html#programming-the-sample 

  • Vidar: thank you for your quick response. I tried to build a configuration and it failed with the information shown below. what am I doing wrong? I unzipped the file and tried to configure as I have done with all of the other samples.

    -- Found devicetree overlay: boards/nrf9160dk_nrf9160_ns.overlay
    In file included from <command-line>:
    ./boards/nrf9160dk_nrf9160_ns.overlay:1:10: fatal error: nrf9160dk_nrf52840_reset_on_if5.dtsi: No such file or directory
    1 | #include <nrf9160dk_nrf52840_reset_on_if5.dtsi>
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    CMake Error at C:/Nordic1/v2.5.0/zephyr/cmake/modules/extensions.cmake:3885 (message):
    failed to preprocess devicetree files (error code 1):
    C:/Nordic1/v2.5.0/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840.dts;boards/nrf9160dk_nrf9160_ns.overlay
    Call Stack (most recent call first):
    C:/Nordic1/v2.5.0/zephyr/cmake/modules/dts.cmake:226 (zephyr_dt_preprocess)
    C:/Nordic1/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
    C:/Nordic1/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/Nordic1/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
    CMakeLists.txt:8 (find_package)


    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: 'C:\Nordic1\toolchains\c57af46cb7\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/Nordic1/toolchains/c57af46cb7/opt/bin/python.exe '-Bc:\Nordic1\test_n160\central_uart_n9160\build' -GNinja -DBOARD=nrf21540dk_nrf52840 -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DCONF_FILE:STRING=c:/Nordic1/test_n160/central_uart_n9160/prj.conf -DDTC_OVERLAY_FILE:STRING=boards/nrf9160dk_nrf9160_ns.overlay '-DBOARD_ROOT:STRING=c:/nordic1/test/peripheral_uart;c:/nordic1/test/ble_prototype;c:/nordic1/test/i2c_api;c:/nordic1/test_n160/asset_tracker_v2_n9160;c:/nordic1/test_n160/central_uart_n9160;.' '-Sc:\Nordic1\test_n160\central_uart_n9160'

    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

  • Does your build configuration look identical to mine here: 

    ? From the build log you posted, we can see the 9160 overlay is picked up by the build system, but I don't understand the reference to the nrf21540dk here: Bc:\Nordic1\test_n160\central_uart_n9160\build' -GNinja -DBOARD=nrf21540dk_nrf52840 -

    It would also be interesting to know if you receive the same error if you build the Cellular: LTE Sensor Gateway sample.

  • I had left out the second overlay file. It does build a configuration file now but when I go to build it I get the following errors. I am still missing something. any ideas?

    [291/298] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\Nordic1\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\Nordic1\test_n160\central_uart_n9160\build\zephyr && C:\Nordic1\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_irq_rx_disable':
    C:\Nordic1\test_n160\central_uart_n9160\build\zephyr\include\generated\syscalls\uart.h:278: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `z_impl_uart_irq_rx_enable':
    C:\Nordic1\v2.5.0\zephyr\include\zephyr\drivers\uart.h:960: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_irq_tx_disable':
    C:\Nordic1\test_n160\central_uart_n9160\build\zephyr\include\generated\syscalls\uart.h:230: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `h4_send':
    C:\Nordic1\v2.5.0\zephyr\drivers\bluetooth\hci\h4.c:490: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_fifo_read':
    C:\Nordic1\v2.5.0\zephyr\include\zephyr\drivers\uart.h:820: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj):C:\Nordic1\v2.5.0\zephyr\drivers\bluetooth\hci\h4.c:560: more undefined references to `__device_dts_ord_118' follow
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\Nordic1\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Nordic1\test_n160\central_uart_n9160\build'

    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

Reply
  • I had left out the second overlay file. It does build a configuration file now but when I go to build it I get the following errors. I am still missing something. any ideas?

    [291/298] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\Nordic1\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\Nordic1\test_n160\central_uart_n9160\build\zephyr && C:\Nordic1\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_irq_rx_disable':
    C:\Nordic1\test_n160\central_uart_n9160\build\zephyr\include\generated\syscalls\uart.h:278: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `z_impl_uart_irq_rx_enable':
    C:\Nordic1\v2.5.0\zephyr\include\zephyr\drivers\uart.h:960: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_irq_tx_disable':
    C:\Nordic1\test_n160\central_uart_n9160\build\zephyr\include\generated\syscalls\uart.h:230: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `h4_send':
    C:\Nordic1\v2.5.0\zephyr\drivers\bluetooth\hci\h4.c:490: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_fifo_read':
    C:\Nordic1\v2.5.0\zephyr\include\zephyr\drivers\uart.h:820: undefined reference to `__device_dts_ord_118'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj):C:\Nordic1\v2.5.0\zephyr\drivers\bluetooth\hci\h4.c:560: more undefined references to `__device_dts_ord_118' follow
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\Nordic1\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Nordic1\test_n160\central_uart_n9160\build'

    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

Children
  • Not sure what I'm missing, but it should not have been neccessary to add the overlay manually. As I test, can you try to remove the build folder, then set up the build configuration again, but this time with the board revision set to 1.1.0?

    Edit: the "\hci\h4.c:560: more undefined references to `__device_dts_ord_118' follow" error likely means the CONFIG_NRF_SW_LPUART symbol did not get enabled in your build. It should habe been enabled by the central_uart/boards/nrf9160dk_nrf9160_ns.conf file.

  • errors now are shown below. A different undefined.  I was hoping the sample Bluetooth/central_uart would be the simple way to connect to the Bluetooth/peripheral_uart but that does not seem to work.

    what am I missing?

    zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main/nofp" -LC:/Nordic1/test_n160/central_uart_n9160/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_INTEGER_PRINTF_SCANF C:/Nordic1/v2.5.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc310_platform_0.9.18.a --specs=picolibc.specs -lc -lgcc && cmd.exe /C "cd /D C:\Nordic1\test_n160\central_uart_n9160\build\zephyr && C:\Nordic1\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_irq_rx_disable':
    C:\Nordic1\test_n160\central_uart_n9160\build\zephyr\include\generated\syscalls\uart.h:278: undefined reference to `__device_dts_ord_123'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `z_impl_uart_irq_rx_enable':
    C:\Nordic1\v2.5.0\zephyr\include\zephyr\drivers\uart.h:960: undefined reference to `__device_dts_ord_123'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_irq_tx_disable':
    C:\Nordic1\test_n160\central_uart_n9160\build\zephyr\include\generated\syscalls\uart.h:230: undefined reference to `__device_dts_ord_123'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `h4_send':
    C:\Nordic1\v2.5.0\zephyr\drivers\bluetooth\hci\h4.c:490: undefined reference to `__device_dts_ord_123'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj): in function `uart_fifo_read':
    C:\Nordic1\v2.5.0\zephyr\include\zephyr\drivers\uart.h:820: undefined reference to `__device_dts_ord_123'
    c:/nordic1/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4.c.obj):C:\Nordic1\v2.5.0\zephyr\drivers\bluetooth\hci\h4.c:560: more undefined references to `__device_dts_ord_123' follow
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\Nordic1\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Nordic1\test_n160\central_uart_n9160\build'

    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

  • I'm afraid I don't have an explanation for why it is failing to build now. I had a coworker try the same project I uploaded here, and he couldn't reproduce the issue either. 

    Here's a screenshot of what I'm seeing after building the project for comparison:

    But did you try with the Cellular: LTE Sensor Gateway sample? As mentioned earlier, I took must of my changes from that project, so it would be interesting to know if it results in the same errors or not.

  • I get similar messages if I just build the LTE App unchanged.

  • I started from scratch. I unzipped your file and opened existing application and rebuilt the application. I still get the errors. below is my screen shot similar to yours.  what am I doing wrong or missing?

Related