I like to use the DTM mode in a test mode of our device based on nRF5340. Using SDK 2.7.0 with Zephyr. Started with using the DTM example but it does not build. Beyond other errors
is not defined.
How can I use DTM on nRF5340 with Zephyr / SDK 2.7.0
I like to use the DTM mode in a test mode of our device based on nRF5340. Using SDK 2.7.0 with Zephyr. Started with using the DTM example but it does not build. Beyond other errors
is not defined.
How can I use DTM on nRF5340 with Zephyr / SDK 2.7.0
Hello,
If you get an error saying NRF_RADIO_Type is not defined, it usually means you have attempted to build the project for the application core instead of the network core. The application does not have direct access to the RADIO peripheral.
Supported build target:

https://docs.nordicsemi.com/bundle/ncs-2.9.0/page/nrf/samples/bluetooth/direct_test_mode/README.html
Best regards,
Vidar
Hi Vidar,
thank you for your quick answer. This sounds resonable.
Took the network core with SDK 2.7.0 and get a compile error due to missing header files
[{
"resource": "/c:/ncs/v2.7.0/zephyr/cmake/modules/kconfig.cmake",
"owner": "nrf-connect",
"severity": 8,
"message": "CMake Error at C:/ncs/v2.7.0/zephyr/cmake/modules/kconfig.cmake:392 (message):",
"source": "cmake",
"startLineNumber": 392,
"startColumn": 1,
"endLineNumber": 392,
"endColumn": 2147483647
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/kernel.h\"",
"source": "C/C++",
"startLineNumber": 8,
"startColumn": 1,
"endLineNumber": 8,
"endColumn": 27
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/logging/log.h\"",
"source": "C/C++",
"startLineNumber": 9,
"startColumn": 1,
"endLineNumber": 9,
"endColumn": 32
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/drivers/uart.h\"",
"source": "C/C++",
"startLineNumber": 10,
"startColumn": 1,
"endLineNumber": 10,
"endColumn": 33
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/net_buf.h\"",
"source": "C/C++",
"startLineNumber": 11,
"startColumn": 1,
"endLineNumber": 11,
"endColumn": 28
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/bluetooth/hci_types.h\"",
"source": "C/C++",
"startLineNumber": 12,
"startColumn": 1,
"endLineNumber": 12,
"endColumn": 40
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/sys/util.h\"",
"source": "C/C++",
"startLineNumber": 13,
"startColumn": 1,
"endLineNumber": 13,
"endColumn": 29
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/sys/byteorder.h\"",
"source": "C/C++",
"startLineNumber": 14,
"startColumn": 1,
"endLineNumber": 14,
"endColumn": 34
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "#include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit (D:\\sw\\test54Hello\\direct_test_mode\\src\\transport\\dtm_hci.c).",
"source": "C/C++",
"startLineNumber": 15,
"startColumn": 1,
"endLineNumber": 15,
"endColumn": 17
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/types.h\" (dependency of \"dtm.h\")",
"source": "C/C++",
"startLineNumber": 15,
"startColumn": 1,
"endLineNumber": 15,
"endColumn": 17
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/net_buf.h\" (dependency of \"hci_uart.h\")",
"source": "C/C++",
"startLineNumber": 17,
"startColumn": 1,
"endLineNumber": 17,
"endColumn": 22
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/src/transport/dtm_hci.c",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file \"zephyr/net_buf.h\" (dependency of \"dtm_transport.h\")",
"source": "C/C++",
"startLineNumber": 18,
"startColumn": 1,
"endLineNumber": 18,
"endColumn": 27
},{
"resource": "/d:/sw/test54Hello/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.conf",
"owner": "cpptools",
"severity": 4,
"message": "attempt to assign the value 'y' to the undefined symbol NRFX_GPPI",
"source": "gcc",
"startLineNumber": 12,
"startColumn": 1,
"endLineNumber": 12,
"endColumn": 2147483647
}]
For 2.9.0 I get the error
[4/154] Generating include/generated/zephyr/version.h
-- Zephyr version: 3.7.99 (C:/ncs/v2.9.0/zephyr), build: v3.7.99-ncs2
[149/154] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map D:/sw/test54Hello/direct_test_mode/build/direct_test_mode/zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\b620d30767\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -Os -DNDEBUG -gdwarf-4 -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=D:/sw/test54Hello/direct_test_mode/build/direct_test_mode/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/arch/arch/arm/core/cortex_m/cmse/libarch__arm__core__cortex_m__cmse.a zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/soc/soc/nrf5340/libsoc__nordic.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/mbox/libdrivers__mbox.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a modules/segger/libmodules__segger.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -LD:/sw/test54Hello/direct_test_mode/build/direct_test_mode/zephyr zephyr/arch/common/libisr_tables.a -mcpu=cortex-m33+nodsp -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -fuse-ld=bfd -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 -specs=picolibc.specs -DPICOLIBC_LONG_LONG_PRINTF_SCANF -L"c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main/nofp" -lc -lgcc && cmd.exe /C "cd /D D:\sw\test54Hello\direct_test_mode\build\direct_test_mode\zephyr && C:\ncs\toolchains\b620d30767\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(dtm_uart_twowire.c.obj): in function `dtm_tr_init':
D:/sw/test54Hello/direct_test_mode/src/transport/dtm_uart_twowire.c:732: undefined reference to `__device_dts_ord_14'
c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(dtm_uart_twowire.c.obj): in function `dtm_tr_get':
D:/sw/test54Hello/direct_test_mode/src/transport/dtm_uart_twowire.c:793: undefined reference to `__device_dts_ord_14'
c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(dtm_uart_twowire.c.obj): in function `on_test_tx_cmd':
D:/sw/test54Hello/direct_test_mode/src/transport/dtm_uart_twowire.c:673: undefined reference to `__device_dts_ord_14'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[10/16] No configure step for 'remote_shell'
FAILED: _sysbuild/sysbuild/images/direct_test_mode-prefix/src/direct_test_mode-stamp/direct_test_mode-build D:/sw/test54Hello/direct_test_mode/build/_sysbuild/sysbuild/images/direct_test_mode-prefix/src/direct_test_mode-stamp/direct_test_mode-build
cmd.exe /C "cd /D D:\sw\test54Hello\direct_test_mode\build\direct_test_mode && C:\ncs\toolchains\b620d30767\opt\bin\cmake.exe --build ."
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\b620d30767\opt\bin\cmake.EXE' --build D:/sw/test54Hello/direct_test_mode/build
So far could not find any combination of SDK or config file to get the project build
Best regards
Georg
Hi Vidar,
Yes, my build configuration matches this.
Switching to 2.9.0 was just due to lack of other ideas. Our project bases on 2.7.0 and we like to stay with that.
But building neither works for 2.7.0 nor 2.9.0.
Hi,
I see. Yes, that makes sense. Could you make a zip of the direct_test_mode folder in D:/sw/test54Hello/direct_test_mode and upload it here so I can try to find out why the project fails to build?
Hi Vidar,
the zip I have attached. It is just the nrf sample for DTM.
Please have a look at it
Best regards
Georg5367.direct_test_mode.zip
Hi Georg,
Thanks, I just wanted to make sure nothing was changed in the project configuration. It seemed like the linker errors did not match the source code. Unfortunately, I have not managed to reproduce the build issue here.
Does your the cmake output in your build log show that this overlay is found as in my case below?

This overlay selects the communication interface to use with DTM:

It would also be helpful if you could share your build log.
Best regards,
Vidar
Hi Vidar,
think I found the reason. May be I mixed up the sample from 2.9.0 and tried to build it with 2.7.0 after build with 2.9.0 failed.
I deleted everything and setup the DTM sample again by taking care of diffenrent versions of SDK
Now I could build it, but: With the nrf Connect DTM program I can not access it. DTM tries to communicate with COM Port, but there is no response. Tried both COM ports provided by DK.
How can I use this example with the nrf connect DTM tool?
Best regards
Georg
Hi Vidar,
think I found the reason. May be I mixed up the sample from 2.9.0 and tried to build it with 2.7.0 after build with 2.9.0 failed.
I deleted everything and setup the DTM sample again by taking care of diffenrent versions of SDK
Now I could build it, but: With the nrf Connect DTM program I can not access it. DTM tries to communicate with COM Port, but there is no response. Tried both COM ports provided by DK.
How can I use this example with the nrf connect DTM tool?
Best regards
Georg
I could just get the serial communication running. But I do not know what I have done to get it running.
I gave up with DTM
Sorry to hear that. I thought it was working after your previous comment.
Hi Vidar, yes I got it running once. I tried again with the same failure, that it does not build any more. Sometimes I can build it, but after flashing the serial communication does not work. Sometimes it does. No idea whats going on. Thats why I do not continue with this topic at the moment. But I will have to implement it into out device for BLE certification. So may be I will contact Nordic again when I pick up this topic. For now we can close this issue.
Thank you very much for your support
Georg