Hello,
I am currently using nrfx_pdm drivers to interface microphone. And the project builds properly while i am using main.c file.
But now i am deploying edge impulse model on my nRF52840 DK. So i have to change main.c to main.cpp file. I have added essential configurations in project.conf file.
Below is .conf file
CONFIG_GPIO=y CONFIG_NRFX_PDM=y # When on-board microphone is used the DMA must run w/o things # that could slow it down. So DMA logging must be completely # disabled and DMA interrupts must run at maximum priority. #CONFIG_DMA=y #CONFIG_DMA_0_IRQ_PRI=0 #CONFIG_HEAP_MEM_POOL_SIZE=1024 CONFIG_SERIAL=y CONFIG_USB=y CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="Zephyr USB console sample" CONFIG_USB_UART_CONSOLE=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_LINE_CTRL=y CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" # enable c++ support CONFIG_CPLUSPLUS=y CONFIG_LIB_CPLUSPLUS=y CONFIG_NEWLIB_LIBC=y CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y CONFIG_FPU=y CONFIG_MAIN_STACK_SIZE=8192 CONFIG_CONSOLE_SUBSYS=y CONFIG_CONSOLE_GETLINE=y
If i run my code as main.c file it compiles properly. But if i build as .cpp file it throws error in PDM_Nrfx_clock frequency configuration as shown below.
My cmakefile.
# SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.13.1) include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(hello_world_user) target_sources(app PRIVATE src/main.cpp) set(MODEL_FOLDER .) include(${MODEL_FOLDER}/edge-impulse-sdk/cmake/utils.cmake) add_subdirectory(${MODEL_FOLDER}/edge-impulse-sdk/cmake/zephyr) target_include_directories(app PRIVATE ${MODEL_FOLDER} ${MODEL_FOLDER}/tflite-model ${MODEL_FOLDER}/model-parameters ) include_directories(${INCLUDES}) # find model source files RECURSIVE_FIND_FILE(MODEL_FILES "${MODEL_FOLDER}/tflite-model" "*.cpp") list(APPEND SOURCE_FILES ${MODEL_FILES}) # add all sources to the project target_sources(app PRIVATE ${SOURCE_FILES})