DEVICE_DT_GET failing to get nordic_nus_uart

I am using the nRF Connect SDK v2.3.0 to build applications for nRF5340 audio boards . In particular I am interested in the application : ..\nrf\applications\nrf5340_audio .This builds and executes on the boards without issues using the buildprog.py script.

I am now trying to add extra functionality to this audio application inspired by the sample ..nrf\samples\bluetooth\peripheral_uart, to be able to send separate data over BLE to the board from an nRF Connect application. 

The following line I add causes the the build to fail :  

static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));

The issue is as as follows : 

C:/ncs/v2.3.0/zephyr/include/zephyr/device.h:83:41: error: '__device_dts_ord_DT_CHOSEN_nordic_nus_uart_ORD' undeclared here (not in a function)
   83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
C:/ncs/v2.3.0/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
  132 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
C:/ncs/v2.3.0/zephyr/include/zephyr/device.h:83:33: note: in expansion of macro '_CONCAT'
   83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
C:/ncs/v2.3.0/zephyr/include/zephyr/device.h:209:37: note: in expansion of macro 'DEVICE_NAME_GET'
  209 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
C:/ncs/v2.3.0/zephyr/include/zephyr/device.h:226:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  226 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
../../../src/main.c:200:36: note: in expansion of macro 'DEVICE_DT_GET'
  200 | static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));
      |                                    ^~~~~~~~~~~~~
../../../src/main.c:200:29: warning: 'uart' defined but not used [-Wunused-variable]
  200 | static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));
      |                             ^~~~
ninja: build stopped: subcommand failed.

This line builds fine in the peripheral_uart sample but not when added to this audio application.  I have all the required headers included etc. No doubt it is something trivial but I can't see it currently. What could be the issue here? Thank you in advance. 

Parents Reply
  • Hi   Thanks for your reply. I am trying to send Bluetooth data from from an nRF Connect mobile phone application to an nRF5340 audio development kit board (just one way). This already works when using the provided peripheral_uart sample. I am trying to integrate this functionality into the nrf5340_audio application, so that the development board can switch to a broadcast source based on a string that it receives over Bluetooth from the nRF Connect app. 

Children
Related