Adding VM3011 Audio Driver Issues

I'm attempting to integrate the VM3011 audio driver into my project which uses the Thingy53 platform.

This question originally led me to Edge Impulse's VM3011 driver code: Audio driver for VM3011 in Thingy:53 - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

I copied the vm3011 folder: firmware-nordic-thingy53/drivers/vm3011 at main · edgeimpulse/firmware-nordic-thingy53 · GitHub from their repository into my own project under a /drivers folder at the root of my application.

I think added the corresponding KConfig options from the driver to the prj.conf file:

# Microphone Support
CONFIG_VM3011=y
CONFIG_VM3011_PDM_BUFFER_SIZE=1600
CONFIG_AUDIO=y
CONFIG_AUDIO_DMIC=y
CONFIG_AUDIO_DMIC_LOG_LEVEL_DBG=y

and finally in the root CMakeLists.txt for the project I added:

set(ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/drivers/vm3011)

When I attempt to compile my project I get the following error:

C:/ncs/v2.3.0/zephyr/scripts/kconfig/kconfig.py: Dependency loop
===============

I2C (defined at boards/shields\x_nucleo_53l0a1\Kconfig.defconfig:9, C:/ncs/v2.3.0/zephyr/boards/arm/thingy53_nrf5340/Kconfig.defconfig:95, drivers/i2c/Kconfig:9), with definition...

config I2C
        bool
        default y
        depends on SHIELD_X_NUCLEO_53L0A1

config I2C
        bool
        default y
        depends on !TRUSTED_EXECUTION_SECURE && (BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS)

menuconfig I2C
        bool "I2C Drivers"
        help
          Enable I2C Driver Configuration

My questions are as follows:
1) Why would my project, which targets that thingy53_nrf5340_cpuapp_ns board target pull in some kconfig resources for the x_nucleo_53l0a1 shield? This reference to the shield is causing a dependency loop error listed above. How would I debug why this shield file gets pulled in?

2) Is there a good example for adding an out of tree driver to a basic project? My understanding is that I need to provide the driver files which Edge Impulse as already written, then add a devicetree overlay file that adds the vm3011 to system and it should just work correct?

  • I made a mistake when copying and pasting the error message. Here is the full message:

    C:/ncs/v2.3.0/zephyr/scripts/kconfig/kconfig.py: Dependency loop
    ===============
    
    I2C (defined at boards/shields\x_nucleo_53l0a1\Kconfig.defconfig:9, C:/ncs/v2.3.0/zephyr/boards/arm/thingy53_nrf5340/Kconfig.defconfig:95, drivers/i2c/Kconfig:9), with definition...
    
    config I2C
            bool
            default y
            depends on SHIELD_X_NUCLEO_53L0A1
    
    config I2C
            bool
            default y
            depends on !TRUSTED_EXECUTION_SECURE && (BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS)
    
    menuconfig I2C
            bool "I2C Drivers"
            help
              Enable I2C Driver Configuration
    
    (select-related dependencies: (GPIO_SX1509B && DT_HAS_SEMTECH_SX1509B_ENABLED && GPIO) || (GPIO_PCA953X && DT_HAS_TI_TCA9538_ENABLED && GPIO) || (GPIO_PCF8574 && DT_HAS_NXP_PCF8574_ENABLED && GPIO) || (GPIO_NPM6001 && DT_HAS_NORDIC_NPM6001_GPIO_ENABLED && GPIO) || (ADC_ADS1X1X && (DT_HAS_TI_ADS1013_ENABLED || DT_HAS_TI_ADS1014_ENABLED || DT_HAS_TI_ADS1015_ENABLED || DT_HAS_TI_ADS1113_ENABLED || DT_HAS_TI_ADS1114_ENABLED || DT_HAS_TI_ADS1115_ENABLED || DT_HAS_TI_ADS1119_ENABLED) && ADC) || (ADC_ADS1119 && DT_HAS_TI_ADS1119_ENABLED && ADC) || (DAC_DACX3608 && (DT_HAS_TI_DAC43608_ENABLED || DT_HAS_TI_DAC53608_ENABLED) && DAC) || (DAC_MCP4725 && DT_HAS_MICROCHIP_MCP4725_ENABLED && DAC) || (DAC_MCP4728 && DT_HAS_MICROCHIP_MCP4728_ENABLED && DAC) || (WDT_NPM6001 && DT_HAS_NORDIC_NPM6001_WDT_ENABLED && WATCHDOG) || (W1_DS2484 && DT_HAS_MAXIM_DS2484_ENABLED && W1) || (W1_DS2485 && DT_HAS_MAXIM_DS2485_ENABLED && W1) || (ADT7420 && DT_HAS_ADI_ADT7420_ENABLED && SENSOR) || (AK8975 && DT_HAS_ASAHI_KASEI_AK8975_ENABLED && SENSOR) || (AMG88XX && DT_HAS_PANASONIC_AMG88XX_ENABLED && SENSOR) || (AMS_IAQ_CORE && DT_HAS_AMS_IAQCORE_ENABLED && SENSOR) || (APDS9960 && DT_HAS_AVAGO_APDS9960_ENABLED && SENSOR) || (BMA280 && DT_HAS_BOSCH_BMA280_ENABLED && SENSOR) || (BMC150_MAGN && DT_HAS_BOSCH_BMC150_MAGN_ENABLED && SENSOR) || (BME680 && DT_HAS_BOSCH_BME680_ENABLED && SENSOR) || (BMG160 && DT_HAS_BOSCH_BMG160_ENABLED && SENSOR) || (BMM150 && DT_HAS_BOSCH_BMM150_ENABLED && SENSOR) || (BQ274XX && DT_HAS_TI_BQ274XX_ENABLED && SENSOR) || (CCS811 && DT_HAS_AMS_CCS811_ENABLED && SENSOR) || (DPS310 && DT_HAS_INFINEON_DPS310_ENABLED && SENSOR) || (ENS210 && DT_HAS_AMS_ENS210_ENABLED && SENSOR) || (FDC2X1X && DT_HAS_TI_FDC2X1X_ENABLED && NEWLIB_LIBC && SENSOR) || (TI_HDC && DT_HAS_TI_HDC_ENABLED && SENSOR) || (TI_HDC20XX && (DT_HAS_TI_HDC2010_ENABLED || DT_HAS_TI_HDC2021_ENABLED || DT_HAS_TI_HDC2022_ENABLED || DT_HAS_TI_HDC2080_ENABLED) && SENSOR) || (HMC5883L && DT_HAS_HONEYWELL_HMC5883L_ENABLED && SENSOR) || (HP206C && DT_HAS_HOPERF_HP206C_ENABLED && SENSOR) || (INA23X && (DT_HAS_TI_INA230_ENABLED || DT_HAS_TI_INA237_ENABLED) && SENSOR) || (ISL29035 && DT_HAS_ISIL_ISL29035_ENABLED && SENSOR) || (INA219 && DT_HAS_TI_INA219_ENABLED && SENSOR) || (LIS3MDL && DT_HAS_ST_LIS3MDL_MAGN_ENABLED && SENSOR) || (LM75 && DT_HAS_LM75_ENABLED && SENSOR) || (LM77 && DT_HAS_LM77_ENABLED && SENSOR) || (LPS22HB && DT_HAS_ST_LPS22HB_PRESS_ENABLED && SENSOR) || (LPS25HB && DT_HAS_ST_LPS25HB_PRESS_ENABLED && SENSOR) || (LSM303DLHC_MAGN && DT_HAS_ST_LSM303DLHC_MAGN_ENABLED && SENSOR) || (LSM6DS0 && DT_HAS_ST_LSM6DS0_ENABLED && SENSOR) || (LSM9DS0_GYRO && DT_HAS_ST_LSM9DS0_GYRO_ENABLED && SENSOR) || (LSM9DS0_MFD && DT_HAS_ST_LSM9DS0_MFD_ENABLED && SENSOR) || (MAX17055 && DT_HAS_MAXIM_MAX17055_ENABLED && SENSOR) || (MAX17262 && DT_HAS_MAXIM_MAX17262_ENABLED && SENSOR) || (MAX30101 && DT_HAS_MAXIM_MAX30101_ENABLED && SENSOR) || (MAX31875 && DT_HAS_MAXIM_MAX31875_ENABLED && SENSOR) || (MAX44009 && DT_HAS_MAXIM_MAX44009_ENABLED && SENSOR) || (MCP9808 && DT_HAS_MICROCHIP_MCP9808_ENABLED && SENSOR) || (MPR && DT_HAS_HONEYWELL_MPR_ENABLED && SENSOR) || (MPU6050 && DT_HAS_INVENSENSE_MPU6050_ENABLED && SENSOR) || (MPU9250 && DT_HAS_INVENSENSE_MPU9250_ENABLED && SENSOR) || (MS5837 && DT_HAS_MEAS_MS5837_ENABLED && SENSOR) || (OPT3001 && DT_HAS_TI_OPT3001_ENABLED && SENSOR) || (SBS_GAUGE && DT_HAS_SBS_SBS_GAUGE_ENABLED && SENSOR) || (SGP40 && DT_HAS_SENSIRION_SGP40_ENABLED && SENSOR) || (SHTCX && DT_HAS_SENSIRION_SHTCX_ENABLED && SENSOR) || (SHT3XD && DT_HAS_SENSIRION_SHT3XD_ENABLED && SENSOR) || (SHT4X && DT_HAS_SENSIRION_SHT4X_ENABLED && SENSOR) || (SI7006 && DT_HAS_SILABS_SI7006_ENABLED && SENSOR) || (SI7055 && DT_HAS_SILABS_SI7055_ENABLED && SENSOR) || (SI7060 && DT_HAS_SILABS_SI7060_ENABLED && SENSOR) || (SI7210 && DT_HAS_SILABS_SI7210_ENABLED && SENSOR) || (STTS751 && DT_HAS_ST_STTS751_ENABLED && SENSOR) || (SX9500 && DT_HAS_SEMTECH_SX9500_ENABLED && SENSOR) || (TH02 && DT_HAS_HOPERF_TH02_ENABLED && SENSOR) || (TMP007 && DT_HAS_TI_TMP007_ENABLED && SENSOR) || (TMP108 && (DT_HAS_TI_TMP108_ENABLED || DT_HAS_AMS_AS6212_ENABLED) && SENSOR) || (TMP112 && DT_HAS_TI_TMP112_ENABLED && SENSOR) || (TMP116 && DT_HAS_TI_TMP116_ENABLED && SENSOR) || (VCNL4040 && DT_HAS_VISHAY_VCNL4040_ENABLED && SENSOR) || (VL53L0X && DT_HAS_ST_VL53L0X_ENABLED && SENSOR) || (ITDS && DT_HAS_WE_WSEN_ITDS_ENABLED && SENSOR) || (COUNTER_MICROCHIP_MCP7940N && DT_HAS_MICROCHIP_MCP7940N_ENABLED && COUNTER) || (HT16K33 && DT_HAS_HOLTEK_HT16K33_ENABLED && LED) || (LP3943 && DT_HAS_TI_LP3943_ENABLED && LED) || (LP503X && DT_HAS_TI_LP503X_ENABLED && LED) || (LP5562 && DT_HAS_TI_LP5562_ENABLED && LED) || (PCA9633 && DT_HAS_NXP_PCA9633_ENABLED && LED) || (TLC59108 && DT_HAS_TI_TLC59108_ENABLED && LED) || (AUDIO_TLV320DAC && DT_HAS_TI_TLV320DAC_ENABLED && GPIO && AUDIO_CODEC && AUDIO) || (KSCAN_FT5336 && DT_HAS_FOCALTECH_FT5336_ENABLED && KSCAN) || (KSCAN_GT911 && DT_HAS_GOODIX_GT911_ENABLED && KSCAN) || (KSCAN_CST816S && DT_HAS_HYNITRON_CST816S_ENABLED && KSCAN) || (KSCAN_CAP1203 && DT_HAS_MICROCHIP_CAP1203_ENABLED && KSCAN) || (VIDEO_MT9M114 && DT_HAS_APTINA_MT9M114_ENABLED && VIDEO) || (VIDEO_OV7725 && DT_HAS_OVTI_OV7725_ENABLED && VIDEO) || (VIDEO_OV2640 && DT_HAS_OVTI_OV2640_ENABLED && VIDEO) || (EEPROM_AT24 && DT_HAS_ATMEL_AT24_ENABLED && EEPROM) || (REGULATOR_PCA9420 && DT_HAS_NXP_PCA9420_ENABLED && REGULATOR) || (SBS_GAUGE_NEW_API && DT_HAS_SBS_SBS_GAUGE_NEW_API_ENABLED && FUEL_GAUGE))
    
    ...depends on DPS310 (defined at drivers/sensor/dps310/Kconfig:6), with definition...
    
    menuconfig DPS310
            bool "DPS310 sensor"
            default y
            select I2C
            depends on DT_HAS_INFINEON_DPS310_ENABLED && SENSOR
            help
              Enable driver for DPS310 I2C-based temperature and pressure sensor.
    
    ...depends on SENSOR (defined at boards/shields\x_nucleo_53l0a1\Kconfig.defconfig:12, C:/ncs/v2.3.0/nrf\drivers\sensor/Kconfig:7, drivers/sensor/Kconfig:6), with definition...
    
    config SENSOR
            bool
            default y
            depends on SHIELD_X_NUCLEO_53L0A1
    
    menuconfig SENSOR
            bool "Sensor Drivers"
            help
              Include sensor drivers in config
    
    menuconfig SENSOR
            bool "Sensor Drivers"
            help
              Include sensor drivers in system config
    
    (select-related dependencies: (BT_BAS && BT_CONN && BT_RPC_STACK) || (BT_BAS && BT_CONN && BT_CONN && BT_HCI_HOST && BT_RPC_STACK) || (NRF_802154_SL_OPENSOURCE && NRF_802154_TEMPERATURE_UPDATE && <choice NRF_802154_SL_TYPE>) || (VM3011 && I2C) || (NRF_802154_SL && NRF_802154_TEMPERATURE_UPDATE && !NRF_802154_SOURCE_HAL_NORDIC && <choice NRF_802154_SL_TYPE>) || (NRF_802154_SL_OPENSOURCE && NRF_802154_TEMPERATURE_UPDATE && <choice NRF_802154_SL_TYPE>) || (CLOCK_CONTROL_NRF_USES_TEMP_SENSOR && HAS_HW_NRF_TEMP && CLOCK_CONTROL_NRF_DRIVER_CALIBRATION && CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION && CLOCK_CONTROL_NRF && CLOCK_CONTROL) || (BT_BAS && BT_CONN && BT_CONN && BT_HCI_HOST && BT_HCI && BT))
    
    ...depends on VM3011 (defined at C:/Users/zach/Documents/repositories/nrf_experiments/nus_audio_streamer/drivers/vm3011/Kconfig.vm3011:4), with definition...
    
    menuconfig VM3011
            bool "VM3011 dmic"
            select NRFX_PDM
            select SENSOR
            depends on I2C
            help
              Enable driver for VM3011 Digital MEMS Microphone.
    
    ...depends again on I2C (defined at boards/shields\x_nucleo_53l0a1\Kconfig.defconfig:9, C:/ncs/v2.3.0/zephyr/boards/arm/thingy53_nrf5340/Kconfig.defconfig:95, drivers/i2c/Kconfig:9)
    CMake Error at C:/ncs/v2.3.0/zephyr/cmake/modules/kconfig.cmake:328 (message):

  • Spent some more time digging and troubleshooting and I found a suggested solution from EdgeImpulse here: https://forum.edgeimpulse.com/t/firmware-nordic-thingy-53-build-error-in-nrf-connect-sdk/5533

    The problem is I can't roll back to less than v2.x.x of the SDK.

    Any idea what the root cause of this is? If it builds correctly in nRF SDK 1.9.1 but fails on all v2+ versions what could have changed in the KConfig that would cause this kind of dependence?

  • Hi,

    I'll see if I can track down why the Nucleo configs are being included and get back to you

  • I think you will have to wait for the update from Edge Impulse, which in the forum post they say will take a couple of weeks.

  • Thanks for looking into this  I think you are right and I'll just have to wait and see what EdgeImpulse develops. No sense in doing the work twice.

    Here are a few observations I found while trying to root cause the issue that might be of help to others with similar problems:

    1) The messages that appear in the errors don't actually appear in the files that it references or anywhere in the SDK.

    config I2C
            bool
            default y
            depends on SHIELD_X_NUCLEO_53L0A1

    The above section of the error doesn't exist in the Nucleo shield defconfig file referenced in the error. There are no "bool" or "depends on SHIELD_X_NUCLEO_53L0A1" lines in the actual file.

    2) When I remove the line `select SENSOR` from the vm3011 driver config the dependency loop goes away. I tried tracing the files that SENSOR includes or selects but was not able to find a link back to the nucleo board.

Related