Build error for sample peripheral_uart on nrf52840dk_nrf52840

Using VS Code, I've tried to build the "BLE UART service" (= peripheral_uart) for the nrf52840dk_nrf52840 board.
According to the documentation, this board is supposed to be supported.
Building "BLE Central UART" (= central_uart) was no problem, but with the sample above I can not get over the following error:

C:/Users/xxx/nRF/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_DT_CHOSEN_nordic_nus_uart_ORD' undeclared here (not in a function)

In file included from C:/Users/xxx/nRF/zephyr/include/zephyr/toolchain/gcc.h:98,
                 from C:/Users/xxx/nRF/zephyr/include/zephyr/toolchain.h:50,
                 from C:/Users/xxx/nRF/zephyr/include/zephyr/sys/util.h:18,
                 from C:/Users/xxx/nRF/zephyr/include/zephyr/devicetree.h:26,
                 from C:/Users/xxx/nRF/zephyr/include/zephyr/device.h:12,
                 from X:/BLE/peripheral_uart/src/uart_async_adapter.h:22,
                 from X:/BLE/peripheral_uart/src/main.c:10:
C:/Users/xxx/nRF/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_DT_CHOSEN_nordic_nus_uart_ORD' undeclared here (not in a function)
   89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
C:/Users/xxx/nRF/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
C:/Users/xxx/nRF/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
   89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
C:/Users/xxx/nRF/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
  216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
C:/Users/xxx/nRF/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
X:/BLE/peripheral_uart/src/main.c:62:36: note: in expansion of macro 'DEVICE_DT_GET'
   62 | static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));
      |                                    ^~~~~~~~~~~~~

What could be the cause for this?
What do I need to change?

Also, so far I did not modify anything, however, I need to use the serial port later, and looking at the documentation, I'm not sure if the sample uses the UART or USB on this board. Are there any hints on this?

Parents Reply Children
Related