Issues building sample LORA send project

Hello all NRF developers. I am newbie NRF developer, previously have worked with STM32 and ESP32 devices. The whole nRF and zephyr thing with device tree is still very new to me and I am just getting grasp of it.

My goal is to get he LoRa send/receive working using:
2x NRF52DK NRF52832 and 2x SX1278 LoRa module

I use VSCode NRF Connect extension.

I have done the following steps so far:

  1. Create a new application and and for Application template I select zephyr/samples/drivers/lora/send
    https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/drivers/lora/send
  2. Create build configuration for my project and select nrf52dk_nrf52832 board
  3. I tried to build the project but it failed with the error message "No default LoRa radio specified in DT"

  4. From what I understand, I need to create board overlay and modify SPI property to include lora0, that is exactly what I have done:
    In my project folder, I have created board/nrf52dk_nrf52832.overlay file that contains:
     the following:
    &spi1 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	cs-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
    	pinctrl-0 = <&spi1_default>;
    	pinctrl-1 = <&spi1_sleep>;
    	pinctrl-names = "default", "sleep";
    	lora0: sx1276@0 {
    		compatible = "semtech,sx1276";
    		reg = <0>;
    		reset-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
    		dio-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
    					<&gpio0 22 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
    					<&gpio0 17 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
    		power-amplifier-output = "pa-boost";
    		spi-max-frequency = <125000>;
    	};
    };


  5. Additionally, I have modified the  nrf52dk_nrf52832.dts in my C:\nrf\v2.4.0\boards\arm\nrf52dk_nrf52832 and added lora0 alias:
  6.  I try to build the project again but I am getting the following error:


-- Build files have been written to: D:/Programming/NRF/LORA_TEST/send/build
[1/14] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
[2/14] Generating linker_zephyr_pre0.cmd
[3/14] Generating linker_zephyr_pre1.cmd
[4/14] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\nrf\toolchains\31f4403e35\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf -fuse-ld=bfd -Wl,-T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=D:/Programming/NRF/LORA_TEST/send/build/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/lora/libloramac-node.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/spi/libdrivers__spi.a zephyr/drivers/timer/libdrivers__timer.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a modules/segger/libmodules__segger.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"c:/nrf/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -LD:/Programming/NRF/LORA_TEST/send/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -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 && cmd.exe /C "cd /D D:\Programming\NRF\LORA_TEST\send\build\zephyr && C:\nrf\toolchains\31f4403e35\opt\bin\cmake.exe -E echo ""
c:/nrf/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/lora/libloramac-node.a(sx127x.c.obj): in function `sx127x_read':
C:\nrf\v2.4.0\zephyr\drivers\lora\sx127x.c:422: undefined reference to `__device_dts_ord_107'
c:/nrf/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/lora/libloramac-node.a(sx127x.c.obj): in function `sx127x_lora_init':
C:\nrf\v2.4.0\zephyr\drivers\lora\sx127x.c:622: undefined reference to `__device_dts_ord_107'
c:/nrf/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/lora/libloramac-node.a(sx127x.c.obj): in function `sx127x_write':
C:\nrf\v2.4.0\zephyr\drivers\lora\sx127x.c:427: undefined reference to `__device_dts_ord_107'
c:/nrf/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/lora/libloramac-node.a(sx127x.c.obj):(.rodata.dev_config+0x0): undefined reference to `__device_dts_ord_107'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\nrf\toolchains\31f4403e35\opt\bin\cmake.EXE' --build 'd:\Programming\NRF\LORA_TEST\send\build'

What could be the cause of this issue and how to solve it? I am hoping to receive some advice and clarification on how to move forwards and build the lora sample projects.

You can access my project here:

https://github.com/krupis/nrf52_lora

Related