Unable to Build DMIC Sample on nRF5340 Audio DK

I am currently working on a project involving the nRF5340 Audio Development Kit, and I am facing issues while trying to build the DMIC sample provided in the Zephyr RTOS https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/drivers/audio/dmic.

I am encountering numerous errors when attempting to build the main.c file of the DMIC sample. These errors seem to be originating from the DMIC sample Devicetree file, and despite my best efforts, I have been unable to resolve them.

On the terminal I getting the following error-

In function 'main':

C:/ncs/v2.5.99-dev1/zephyr/include/zephyr/device.h:85:41: error: '__device_dts_ord_DT_N_NODELABEL_dmic_dev_ORD' undeclared (first use in this function)

   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)

      |                                         ^~~~~~~~~

C:/ncs/v2.5.99-dev1/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.5.99-dev1/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'

   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)

      |                                 ^~~~~~~

C:/ncs/v2.5.99-dev1/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'

  211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))

      |                                     ^~~~~~~~~~~~~~~

C:/ncs/v2.5.99-dev1/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'

  228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))

      |                                  ^~~~~~~~~~~~~~~~~~

../src/main.c:80:47: note: in expansion of macro 'DEVICE_DT_GET'

   80 |         const struct device *const dmic_dev = DEVICE_DT_GET(DT_NODELABEL(dmic_dev));

      |                                               ^~~~~~~~~~~~~

C:/ncs/v2.5.99-dev1/zephyr/include/zephyr/device.h:85:41: note: each undeclared identifier is reported only once for each function it appears in

   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)

      |                                         ^~~~~~~~~

C:/ncs/v2.5.99-dev1/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.5.99-dev1/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'

   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)

      |                                 ^~~~~~~

C:/ncs/v2.5.99-dev1/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'

  211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))

      |                                     ^~~~~~~~~~~~~~~

C:/ncs/v2.5.99-dev1/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'

  228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))

      |                                  ^~~~~~~~~~~~~~~~~~

../src/main.c:80:47: note: in expansion of macro 'DEVICE_DT_GET'

   80 |         const struct device *const dmic_dev = DEVICE_DT_GET(DT_NODELABEL(dmic_dev));

      |                                               ^~~~~~~~~~~~~

[7/42] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v2.5.99-dev1/modules/hal/nordic/nrfx/drivers/src/nrfx_gpiote.c.obj

ninja: build stopped: subcommand failed.

Host operating system- Windows

nRF connect sdk toolchain- v2.5.1 

nrf sdk- v2.5.99-dev1

I am using the nRF Connect for VS Code extension.

8015.dmic.zip

Parents
  • Hi Anushikha,

    I'm not from Nordic, but I believe I understand the problem so I dare to answer this question.

    This Zephyr sample works out of the box only for nRF52840 DK and nRF5340 DK (i.e. not for nRF5340 Audio DK). To make it up and running for the audio kit, you need to create a device tree overlay that specifies `dmic_dev` node. You can have a look into `boards` folder which is present in the sample. There you can get some inspiration how this is done for the two supported devkits. 

    One more note - the DMIC sample probably won't work with the microphone which is present on the audio devkit. This microphone is not connected directly to the nRF5340 SoC but it goes through the HW codec and the HW codec is connected via I2S interface. So the `pdm` related API used in the sample couldn't be used here. 

    So the bottom line is, unless you want to use an external microphone, this sample is not suitable for nRF5340 Audio DK anyway.

    Hope this helps. 

    And of course, if I'm wrong, Nordic guys, please shout :) 

    Thanks,

    Ladivin 

Reply
  • Hi Anushikha,

    I'm not from Nordic, but I believe I understand the problem so I dare to answer this question.

    This Zephyr sample works out of the box only for nRF52840 DK and nRF5340 DK (i.e. not for nRF5340 Audio DK). To make it up and running for the audio kit, you need to create a device tree overlay that specifies `dmic_dev` node. You can have a look into `boards` folder which is present in the sample. There you can get some inspiration how this is done for the two supported devkits. 

    One more note - the DMIC sample probably won't work with the microphone which is present on the audio devkit. This microphone is not connected directly to the nRF5340 SoC but it goes through the HW codec and the HW codec is connected via I2S interface. So the `pdm` related API used in the sample couldn't be used here. 

    So the bottom line is, unless you want to use an external microphone, this sample is not suitable for nRF5340 Audio DK anyway.

    Hope this helps. 

    And of course, if I'm wrong, Nordic guys, please shout :) 

    Thanks,

    Ladivin 

Children
No Data
Related