Multi-NUS on the nRF21540-DK

I have succeeded in running the Multi-NUS package on the nRF52840DK. My client's client learned of the nRF21540EK and wants to try using it to extend the range in the present application. Is there an equivalent of the Multi-NUS package available for this board? Fallback would be an NUS application whereby i could gather the routines to access the control lines for the 21540 and merge it with the Multi-NUS software.

Parents
  • The word "should" is a wonderful modifier. The tools "should" do a lot of things.

    By non-intuitively deleting the build configuration, and then non-intuitively selecting non-Nordic boards, notwithstanding the "Nordic" printed all over the 21540 DK, I was able to select the "nRF21540 DK NRF52840" configuration. Then doing "Build Configuration", I get a very long string of build script, ending with this:

    In file included from D:\Nordic\v1.9.1\zephyr\include\toolchain.h:50,
                     from D:\Nordic\v1.9.1\zephyr\include\sys\printk.h:11,
                     from D:\Nordic\v1.9.1\zephyr\include\sys\__assert.h:11,
                     from D:\Nordic\v1.9.1\zephyr\include\drivers\gpio.h:18,
                     from D:\Nordic\v1.9.1\nrf\subsys\mpsl\fem\mpsl_fem.c:8:
    D:/Nordic/v1.9.1/nrf/subsys/mpsl/fem/mpsl_fem.c: In function 'fem_nrf21540_gpio_configure':
    D:\Nordic\v1.9.1\zephyr\include\toolchain\gcc.h:61:36: error: static assertion failed: ""
       61 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
          |                                    ^~~~~~~~~~~~~~
    D:\Nordic\v1.9.1\nrf\subsys\mpsl\fem\mpsl_fem.c:280:2: note: in expansion of macro 'BUILD_ASSERT'
      280 |  BUILD_ASSERT(
          |  ^~~~~~~~~~~~
    [194/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/errno.c.obj
    [195/236] Linking C static library modules\nrf\subsys\mpsl\init\lib..__nrf__subsys__mpsl__init.a
    [196/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/init.c.obj
    [197/236] Building C object modules/nrf/subsys/bluetooth/controller/CMakeFiles/..__nrf__subsys__bluetooth__controller.dir/hci_driver.c.obj
    [198/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/fatal.c.obj
    [199/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/kheap.c.obj
    [200/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mem_slab.c.obj
    [201/236] Building C object modules/nrf/drivers/mpsl/flash_sync/CMakeFiles/..__nrf__drivers__mpsl__flash_sync.dir/flash_sync_mpsl.c.obj
    [202/236] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/gatt.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'd:\Nordic\v1.9.1\toolchain\opt\bin\cmake.EXE' --build 'd:\304\FW\Hook\examples\ble_central\multi-NUS-master21540\build'
    The terminal process terminated with exit code: 1.

    Terminal will be reused by tasks, press any key to close it.

    Apparently an ASSERT macro is trying to warn me about something, but I can't figure out its meaning. Next??

Reply
  • The word "should" is a wonderful modifier. The tools "should" do a lot of things.

    By non-intuitively deleting the build configuration, and then non-intuitively selecting non-Nordic boards, notwithstanding the "Nordic" printed all over the 21540 DK, I was able to select the "nRF21540 DK NRF52840" configuration. Then doing "Build Configuration", I get a very long string of build script, ending with this:

    In file included from D:\Nordic\v1.9.1\zephyr\include\toolchain.h:50,
                     from D:\Nordic\v1.9.1\zephyr\include\sys\printk.h:11,
                     from D:\Nordic\v1.9.1\zephyr\include\sys\__assert.h:11,
                     from D:\Nordic\v1.9.1\zephyr\include\drivers\gpio.h:18,
                     from D:\Nordic\v1.9.1\nrf\subsys\mpsl\fem\mpsl_fem.c:8:
    D:/Nordic/v1.9.1/nrf/subsys/mpsl/fem/mpsl_fem.c: In function 'fem_nrf21540_gpio_configure':
    D:\Nordic\v1.9.1\zephyr\include\toolchain\gcc.h:61:36: error: static assertion failed: ""
       61 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
          |                                    ^~~~~~~~~~~~~~
    D:\Nordic\v1.9.1\nrf\subsys\mpsl\fem\mpsl_fem.c:280:2: note: in expansion of macro 'BUILD_ASSERT'
      280 |  BUILD_ASSERT(
          |  ^~~~~~~~~~~~
    [194/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/errno.c.obj
    [195/236] Linking C static library modules\nrf\subsys\mpsl\init\lib..__nrf__subsys__mpsl__init.a
    [196/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/init.c.obj
    [197/236] Building C object modules/nrf/subsys/bluetooth/controller/CMakeFiles/..__nrf__subsys__bluetooth__controller.dir/hci_driver.c.obj
    [198/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/fatal.c.obj
    [199/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/kheap.c.obj
    [200/236] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mem_slab.c.obj
    [201/236] Building C object modules/nrf/drivers/mpsl/flash_sync/CMakeFiles/..__nrf__drivers__mpsl__flash_sync.dir/flash_sync_mpsl.c.obj
    [202/236] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/gatt.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'd:\Nordic\v1.9.1\toolchain\opt\bin\cmake.EXE' --build 'd:\304\FW\Hook\examples\ble_central\multi-NUS-master21540\build'
    The terminal process terminated with exit code: 1.

    Terminal will be reused by tasks, press any key to close it.

    Apparently an ASSERT macro is trying to warn me about something, but I can't figure out its meaning. Next??

Children
  • In the config file ncs\v1.9.1\nrf\subsys\mpsl\fem\Kconfig

    config MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA
    	int "TX gain value (POUTA)"
    	default 20
    	help
    	  The default value of 20 dB is based on nRF21540 Product Specification (v1.0) and it
    	  corresponds to the configuration in which the pin MODE=0 and register POUTA_SEL=0.
    
    	  Alternatively, if register POUTA_SEL=1, FEM will use TX gain value defined by the UICR.
    	  In that case user must set value of this Kconfig option to match UICR content.
    
    config MPSL_FEM_NRF21540_TX_GAIN_DB_POUTB
    	int "TX gain value (POUTB)"
    	default 10
    	help
    	  The default value of 10 dB is based on nRF21540 Product Specification (v1.0) and it
    	  corresponds to the configuration in which the pin MODE=1 and register POUTB_SEL=0.
    
    	  Alternatively, if register POUTB_SEL=1, FEM will use TX gain value defined by the UICR.
    	  In that case user must set value of this Kconfig option to match UICR content.

    I can understand that this configurations settings can be a bit confusing and if it feels better, there is a strong consideration of making these options easier in the coming releases.

    As per your question, the FEM TX gain should match either POUTA or POUTB TX_GAIN and i am guessing you are trying the TX gain in your case which is not 20 or 10 (default values of POUTA_TX_GAIN and POUTB_TX_GAIN)

Related