How to adapt the Radio Test sample to nRF52840 dongle?

Hi  Nordic

i would like to adapt radio test sample to nRF52840 dongle from based on pca10056.

can you help to check below steps are correct?

1- Followed  the the instruction :  nRF52840 Dongle Programming Tutorial - Getting Started - nRF5 SDK guides - Nordic DevZone (nordicsemi.com),

2-  added below UART pins definition into pca11059.h, for example

#define RX_PIN_NUMBER NRF_GPIO_PIN_MAP(1,1)
#define TX_PIN_NUMBER NRF_GPIO_PIN_MAP(1,2)
#define CTS_PIN_NUMBER NRF_GPIO_PIN_MAP(1,4)
#define RTS_PIN_NUMBER NRF_GPIO_PIN_MAP(1,7) 

3- Programming and use p1.1 and p1.2 for uart communiction.

//

SDK : nRF5_SDK_17.1.0_ddde560\examples\peripheral\radio_test\pca10056

SEGGER Embedded Studio for ARM 7.12a

Thanks.

Parents
  • Hi,

    I recommend using the Radio test sample in nRF Connect SDK instead of nRF5 SDK. For the nRF52840 Dongle, you must use USB instead of UART or solder on a serial interface connection on the dongle for UART. The recommendation is to use USB.
    However, modifying an example to use USB and support the dongle is much simpler in nRF Connect SDK than in nRF5 SDK.

    I have added support for the dongle in the nRF Connect SDK radio test sample to show you how it can be done there. radio_test_dongle.zip

    I added two files, nrf52840dongle_nrf52840.conf, and boards/nrf52840dongle_nrf52840.overlay, and made some changes to CMakeLists.txt and main.c:

    diff --git a/samples/peripheral/radio_test/CMakeLists.txt b/samples/peripheral/radio_test/CMakeLists.txt
    index 971270d4d..ea52c3c13 100644
    --- a/samples/peripheral/radio_test/CMakeLists.txt
    +++ b/samples/peripheral/radio_test/CMakeLists.txt
    @@ -29,6 +29,10 @@ if (CONFIG_RADIO_TEST_USB)
       set(remote_shell_CONF_FILE ${CMAKE_CURRENT_LIST_DIR}/conf/remote_shell/prj_usb.conf)
     endif()
     
    +if (${BOARD} STREQUAL "nrf52840dongle_nrf52840")
    +  list(set CONF_FILE "nrf52840dongle_nrf52840.conf")
    +endif()
    +
     find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
     project(NONE)
    

    diff --git a/samples/peripheral/radio_test/src/main.c b/samples/peripheral/radio_test/src/main.c
    index ed81fe871..4668df027 100644
    --- a/samples/peripheral/radio_test/src/main.c
    +++ b/samples/peripheral/radio_test/src/main.c
    @@ -8,6 +8,10 @@
     #include <zephyr/drivers/clock_control.h>
     #include <zephyr/drivers/clock_control/nrf_clock_control.h>
     
    +#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart)
    +#include <zephyr/usb/usb_device.h>
    +#endif
    +
     static void clock_init(void)
     {
            int err;
    @@ -42,6 +46,14 @@ static void clock_init(void)
     
     void main(void)
     {
    +       #if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart)
    +       int ret;
    +       ret = usb_enable(NULL);
    +       if (ret != 0) {
    +               printk("Failed to enable USB\n");
    +               return;
    +       }
    +       #endif
            printk("Starting Radio Test example\n");
     
            clock_init();
    

    For more information on the nRF Connect SDK, please see nRF Connect SDK - Getting started.

    Best regards,
    Marte

  • Hi

    Thanks for your quikly reply.

    1. I deleted the "raido test " and unziped the radio_test_dongle.zip to new  "radio_test”  to the foolder C:\ncs\v2.3.0\nrf\samples\peripheral 

    2. Then follow to the  How to build an application - nRF Connect for VS Code  to create a new application:

    3.i added  "C:/ncs/v2.3.0/zephyr/include/zephyr/**" to  c_cpp_properties.json to solve "Include *.h" issue :

    4. Added build Configuration:

    5. Add "rsource "$srctree/../nrf/samples/bluetooth/direct_test_mode/src/fem/Kconfig"" to Kconfig file to sove the issue:

    6.Another issue happened:

    Can you help to check which wrong configure i have make?

    Thanks.

  • Hi,

    You need to use the zephyr.hex file, under build/zephyr.

    Put the nRF52840 Dongle in Bootloader mode by pressing the reset button as described in nRF52840 Dongle - Programming, then program the zephyr.hex file using the Programmer app.

    Best regards,
    Marte

  • Hello, I had tried that approach, but there appears to be something wrong because I am not able to click the write button.
     

  • Hi,

    What is the address range of the application? The MBR (Master Boot Record) occupies 0x-0xFFF on the nRF52840 dongle, so you need to make sure your application starts after this. In addition, the USB bootloader starts at 0xE0000 and occupies the rest of the flash, so this should also be reserved. This should automatically be configured when you build for the dongle (nrf52840dongle_nrf52840), but if it is not, you can use static partitioning. See Configuring static partitions for more information on this.

    Best regards,
    Marte

  • Hi, you were correct I was building for the incorrect device, however now that I have corrected that and am using nrf52840dongle_nrf52840 I am running into the following build error:

    warning: CONSOLE_HANDLER (defined at drivers/console/Kconfig:27) was assigned the value 'y' but got the value 'n'. 

    In addition, when I tried to add the dongle as the device to build for it was not in the list of compatible devices. I am attaching the config log as well as a screen shot of my build cofig setup, can you please let me know if you see what is going wrong?

    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/nrfWorkspace/radio_test
    -- CMake version: 3.20.5
    -- Found Python3: C:/ncs/toolchains/ffa23e2f3e/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.5.0-rc2/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/ncs/v2.5.0-rc2/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf52840dongle_nrf52840
    -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/ffa23e2f3e/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/ffa23e2f3e/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/ffa23e2f3e/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/ncs/v2.5.0-rc2/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts
    -- Found devicetree overlay: boards/nrf52840dongle_nrf52840.overlay
    -- Generated zephyr.dts: C:/nrfWorkspace/radio_test/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/nrfWorkspace/radio_test/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/nrfWorkspace/radio_test/build/zephyr/dts.cmake

    warning: CONSOLE_HANDLER (defined at drivers/console/Kconfig:27) was assigned the value 'y' but got
    the value 'n'. Check these unsatisfied dependencies: UART_CONSOLE (=n), CONSOLE (=n). See
    docs.zephyrproject.org/.../kconfig.html and/or look up
    CONSOLE_HANDLER in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.

    Parsing C:/ncs/v2.5.0-rc2/zephyr/Kconfig
    Loaded configuration 'C:/ncs/v2.5.0-rc2/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840_defconfig'
    Merged configuration 'C:/nrfWorkspace/radio_test/prj.conf'
    Merged configuration 'C:/nrfWorkspace/radio_test/nrf52840dongle_nrf52840.conf'
    Configuration saved to 'C:/nrfWorkspace/radio_test/build/zephyr/.config'
    Kconfig header saved to 'C:/nrfWorkspace/radio_test/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/ffa23e2f3e/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/ncs/toolchains/ffa23e2f3e/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    -- Configuring incomplete, errors occurred!
    See also "C:/nrfWorkspace/radio_test/build/CMakeFiles/CMakeOutput.log".
    See also "C:/nrfWorkspace/radio_test/build/CMakeFiles/CMakeError.log".
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\ffa23e2f3e\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/ffa23e2f3e/opt/bin/python.exe '-Bc:\nrfWorkspace\radio_test\build' -GNinja -DBOARD=nrf52840dongle_nrf52840 -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DOVERLAY_CONFIG:STRING=nrf52840dongle_nrf52840.conf -DDTC_OVERLAY_FILE:STRING=boards/nrf52840dongle_nrf52840.overlay '-DBOARD_ROOT:STRING=c:/nrfworkspace/blinky_pwm;c:/nrfworkspace/radio_test;c:/nrfworkspace/nrf_ex_radiotest;c:/nrfworkspace/radio_test_1' '-Sc:\nrfWorkspace\radio_test'

  • Hi,

    alliebarrett said:
    In addition, when I tried to add the dongle as the device to build for it was not in the list of compatible devices

    This is because the dongle is not officially supported in the sample.

    alliebarrett said:
    however now that I have corrected that and am using nrf52840dongle_nrf52840 I am running into the following build error:

    warning: CONSOLE_HANDLER (defined at drivers/console/Kconfig:27) was assigned the value 'y' but got the value 'n'. 

    Since the sample does not support the dongle out of the box, you need to apply the changes in my first comment in this ticket: RE: How to adapt the Radio Test sample to nRF52840 dongle? , specifically adding the two files nrf52840dongle_nrf52840.conf, and boards/nrf52840dongle_nrf52840.overlay, and making the changes to CMakeLists.txt and main.c as I mention there.

    Best regards,
    Marte

Reply
  • Hi,

    alliebarrett said:
    In addition, when I tried to add the dongle as the device to build for it was not in the list of compatible devices

    This is because the dongle is not officially supported in the sample.

    alliebarrett said:
    however now that I have corrected that and am using nrf52840dongle_nrf52840 I am running into the following build error:

    warning: CONSOLE_HANDLER (defined at drivers/console/Kconfig:27) was assigned the value 'y' but got the value 'n'. 

    Since the sample does not support the dongle out of the box, you need to apply the changes in my first comment in this ticket: RE: How to adapt the Radio Test sample to nRF52840 dongle? , specifically adding the two files nrf52840dongle_nrf52840.conf, and boards/nrf52840dongle_nrf52840.overlay, and making the changes to CMakeLists.txt and main.c as I mention there.

    Best regards,
    Marte

Children
Related