NRF52840 dongle example for switching between ble frequencies

Hello, I am working on writing a program for my NRF52840 dongle that can transmit a ble continuous wave at 2400MHz at +0dBm. Upon a button press, we'd move over to 2450MHz, with another press we'd go to 2500MHz. Are there any example programs that go through this process? The radio test example seems to have parts that I can use if I remove the uart usage and replace with button presses, which command within this example would be best used to model my program off of?

Thank you!

  • Hello,

    The radio test example can be used to setup the radio in different test modes as described in the documentation:
    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/samples/peripheral/radio_test/README.html 
    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/samples/peripheral/radio_test/README.html#user-interface 

    Normally this is done through the UART interface, however the nRF52840 have a USB interface that can be used to setup the commands. All you need to do is follow the description here:
    https://devzone.nordicsemi.com/f/nordic-q-a/98720/how-to-adapt-the-radio-test-sample-to-nrf52840-dongle/420527 

    Then when connecting the USB you can open a terminal window to send whatever commands you like:

    You may also find this useful:
    https://devzone.nordicsemi.com/f/nordic-q-a/93215/example-code-for-fixed-frequency-for-ce-certification/392419 

    Kenneth

  • Hi Kenneth I am not going to have the device plugged into a port while running this, so I will not be needing the cli interface. I was thinking that using the button presses to call cmd_tx_carrier_start() with the different MHz channel values such as 2400MHz being set in this part of the config: m_test_config.params.unmodulated_tx.channel = m_config.channel_start;
    Does this approach seem correct?

  • I don't have the possibility to dig into the code at the moment, but you should find the example project I made here relevant:
    https://devzone.nordicsemi.com/support-private/support/289537#permalink=760591 

    If you have access to a spectrum analyzer it should be straight forward to sit down and test configurations to verify you get what you want.

    Kenneth

  • Thank you for all of your help, I was able to use the example that you provided to edit the main.c file to omit the uart parts of the project and then I added the nrf52840 dongle files and edited cMakeLists and main.c as described in the adapt radio test post you had linked to. I have confirmed that when I build the config for the nrf52840dongle_nrf52840 I am able to build it correctly. 

    I am now working to add button functionality to this sample and am running into some difficulties bringing it into my radio test code:
    I built the periipheral_lbs sample in order to use the button_changed() function within it and was able to change the code such that the CON_STATUS_LED would turn on when I push the button and off again when I press it again. However, now that I have that working I am running into some problems bringing that functionality into my radio_test code. Specifically, I have added #include <dk_buttons_and_leds.h> the same as has been done in the peripheral_lbs ex but when I build my code I run into errors such as "undefined reference to `dk_buttons_init'" which is a function within dk_buttons_and_leds.h. Is there some additional places I need to be adding references to dk_buttons_and_leds.h for it to be included correctly? I am attaching the build log below:

    zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj
    [148/177] Linking C static library zephyr\drivers\usb\device\libdrivers__usb__device.a
    [149/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/errno.c.obj
    [150/177] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v2.5.0/modules/hal/nordic/nrfx/mdk/system_nrf52840.c.obj
    [151/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/idle.c.obj
    [152/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/msg_q.c.obj
    [153/177] Linking C static library zephyr\drivers\serial\libdrivers__serial.a
    [154/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mailbox.c.obj
    [155/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mutex.c.obj
    [156/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/queue.c.obj
    [157/177] Linking C static library modules\hal_nordic\nrfx\libmodules__hal_nordic__nrfx.a
    [158/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/stack.c.obj
    [159/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/sem.c.obj
    [160/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/system_work_q.c.obj
    [161/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/poll.c.obj
    [162/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/sched.c.obj
    [163/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/xip.c.obj
    [164/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/work.c.obj
    [165/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/condvar.c.obj
    [166/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/fatal.c.obj
    [167/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timer.c.obj
    [168/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/thread.c.obj
    [169/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mempool.c.obj
    [170/177] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timeout.c.obj
    [171/177] Linking C static library zephyr\kernel\libkernel.a
    [172/177] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\ncs\toolchains\c57af46cb7\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 -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=C:/workspace/radio_test/build_1/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/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/lib/posix/liblib__posix.a zephyr/soc/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/soc/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a zephyr/boards/arm/nrf52840dongle_nrf52840/libboards__arm__nrf52840dongle_nrf52840.a zephyr/subsys/random/libsubsys__random.a zephyr/drivers/usb/device/libdrivers__usb__device.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/entropy/libdrivers__entropy.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/hwinfo/libdrivers__hwinfo.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -LC:/workspace/radio_test/build_1/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -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:/ncs/v2.5.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/soft-float/no-interrupts/libnrf_cc310_platform_0.9.18.a --specs=picolibc.specs -lc -lgcc && cmd.exe /C "cd /D C:\workspace\radio_test\build_1\zephyr && C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
    c:/ncs/toolchains/c57af46cb7/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(main.c.obj): in function `button_changed':
    C:\workspace\radio_test\src\main.c:45: undefined reference to `dk_set_led_off'
    c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:\workspace\radio_test\src\main.c:50: undefined reference to `dk_set_led_on'
    c:/ncs/toolchains/c57af46cb7/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(main.c.obj): in function `main':
    C:\workspace\radio_test\src\main.c:167: undefined reference to `dk_leds_init'
    c:/ncs/toolchains/c57af46cb7/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(main.c.obj): in function `init_button':
    C:\workspace\radio_test\src\main.c:62: undefined reference to `dk_buttons_init'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\workspace\radio_test\build_1'

Related