This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PDM microphone interface

HI sir i was trying to interface pdm microphone. i followed the existing ticket  PDM Driver for Zephyr on nrf52840. i had modified the proj.conf as below

CONFIG_PRINTK=y
CONFIG_I2C=y
CONFIG_I2S=y
CONFIG_GPIO=y
#CONFIG_LED=y
#CONFIG_LP3943=y
CONFIG_AUDIO=y
CONFIG_AUDIO_DMIC=y
CONFIG_AUDIO_MPXXDTYY=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_TRUSTED_EXECUTION_NONSECURE=y

but during the loading process i got the error as below

Creating solution microphone.emProject
  cmake -GNinja -DBOARD=nrf9160dk_nrf9160ns -DBOARD_DIR=/home/kadal/Nordic-Tools/ncs/zephyr/boards/arm/nrf9160dk_nrf9160 -B/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns -S/home/kadal/Nordic-Tools/projects/microphone -DZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb -DGNUARMEMB_TOOLCHAIN_PATH=/home/kadal/Nordic-Tools/GNUarm9 -DDTC_OVERLAY_FILE=/home/kadal/Nordic-Tools/projects/microphone/nrf9160dk_nrf9160ns.overlay -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=/home/kadal/Nordic-Tools/Segger/arm_segger_embedded_studio_v530a_linux_x64_nordic/html/configure_nordic_project_menuconfig.py
  -- Application: /home/kadal/Nordic-Tools/projects/microphone
  -- Zephyr version: 2.4.0 (/home/kadal/Nordic-Tools/ncs/zephyr)
  -- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
  -- Board: nrf9160dk_nrf9160ns
  -- Cache files will be written to: /home/kadal/.cache/zephyr
  -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
  -- Found toolchain: gnuarmemb (/home/kadal/Nordic-Tools/GNUarm9)
  -- Found BOARD.dts: /home/kadal/Nordic-Tools/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160ns.dts
  -- Found devicetree overlay: /home/kadal/Nordic-Tools/projects/microphone/nrf9160dk_nrf9160ns.overlay
  -- Generated zephyr.dts: /home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/zephyr/zephyr.dts
  -- Generated devicetree_unfixed.h: /home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/zephyr/include/generated/devicetree_unfixed.h
  Parsing /home/kadal/Nordic-Tools/ncs/zephyr/Kconfig
  Loaded configuration '/home/kadal/Nordic-Tools/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160ns_defconfig'
  Merged configuration '/home/kadal/Nordic-Tools/projects/microphone/prj.conf'
  Configuration saved to '/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/zephyr/.config'
  Kconfig header saved to '/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/zephyr/include/generated/autoconf.h'
  -- Application: /home/kadal/Nordic-Tools/ncs/nrf/samples/spm
  -- Zephyr version: 2.4.0 (/home/kadal/Nordic-Tools/ncs/zephyr)
  -- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
  -- Board: nrf9160dk_nrf9160
  -- Cache files will be written to: /home/kadal/.cache/zephyr
  -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
  -- Found toolchain: gnuarmemb (/home/kadal/Nordic-Tools/GNUarm9)
  -- Found BOARD.dts: /home/kadal/Nordic-Tools/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160.dts
  -- Found devicetree overlay: /home/kadal/Nordic-Tools/ncs/nrf/samples/spm/nrf9160dk_nrf9160.overlay
  -- Generated zephyr.dts: /home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/spm/zephyr/zephyr.dts
  -- Generated devicetree_unfixed.h: /home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/spm/zephyr/include/generated/devicetree_unfixed.h
  Parsing /home/kadal/Nordic-Tools/ncs/zephyr/Kconfig
  Loaded configuration '/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/spm/zephyr/.config'
  No change to configuration in '/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/spm/zephyr/.config'
  No change to Kconfig header in '/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/spm/zephyr/include/generated/autoconf.h'
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/spm
  -- Application: /home/kadal/Nordic-Tools/projects/microphone
  -- Zephyr version: 2.4.0 (/home/kadal/Nordic-Tools/ncs/zephyr)
  -- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
  -- Board: nrf9160dk_nrf9160ns
  -- Cache files will be written to: /home/kadal/.cache/zephyr
  -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
  -- Found toolchain: gnuarmemb (/home/kadal/Nordic-Tools/GNUarm9)
  -- Found BOARD.dts: /home/kadal/Nordic-Tools/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160ns.dts
  -- Found devicetree overlay: /home/kadal/Nordic-Tools/projects/microphone/nrf9160dk_nrf9160ns.overlay
  -- Found devicetree overlay: /home/kadal/Nordic-Tools/projects/microphone/nrf9160dk_nrf9160ns.overlay
  -- Generated zephyr.dts: /home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/zephyr/zephyr.dts
  -- Generated devicetree_unfixed.h: /home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/zephyr/include/generated/devicetree_unfixed.h
  Parsing /home/kadal/Nordic-Tools/ncs/zephyr/Kconfig
  Loaded configuration '/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/zephyr/.config'
  -- Configuring incomplete, errors occurred!
  See also "/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/CMakeFiles/CMakeOutput.log".
  See also "/home/kadal/Nordic-Tools/projects/microphone/build_nrf9160dk_nrf9160ns/CMakeFiles/CMakeError.log".
  nrf9160dk_nrf9160ns.dts.pre.tmp:357.32-361.5: Warning (simple_bus_reg): /soc/cryptocell-sw: missing or empty reg/ranges property
  nrf9160dk_nrf9160ns.dts.pre.tmp:56.42-68.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@40000000/kmu@39000)
  nrf9160dk_nrf9160ns.dts.pre.tmp:305.19-311.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@40000000/power@5000)
  Changed board to secure nrf9160dk_nrf9160 (NOT NS)
  
  === child image spm -  begin ===
  Including boilerplate (Zephyr base (cached)): /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake
  nrf9160dk_nrf9160.dts.pre.tmp:56.42-68.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@50000000/kmu@39000)
  nrf9160dk_nrf9160.dts.pre.tmp:305.19-311.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@50000000/power@5000)
  === child image spm -  end ===
  
  Including boilerplate (Zephyr base (cached)): /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake
  CMake Error at /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake:76 (add_custom_target):
    add_custom_target cannot create target "code_data_relocation_target"
    because another target with the same name already exists.  The existing
    target is a custom target created in source directory
    "/home/kadal/Nordic-Tools/projects/microphone".  See documentation for
    policy CMP0002 for more details.
  Call Stack (most recent call first):
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:9 (find_package)
  
  
  CMake Error at /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake:97 (add_custom_target):
    add_custom_target cannot create target "runners_yaml_props_target" because
    another target with the same name already exists.  The existing target is a
    custom target created in source directory
    "/home/kadal/Nordic-Tools/projects/microphone".  See documentation for
    policy CMP0002 for more details.
  Call Stack (most recent call first):
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:9 (find_package)
  
  
  CMake Error at /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake:158 (add_custom_target):
    add_custom_target cannot create target "pristine" because another target
    with the same name already exists.  The existing target is a custom target
    created in source directory "/home/kadal/Nordic-Tools/projects/microphone".
    See documentation for policy CMP0002 for more details.
  Call Stack (most recent call first):
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:9 (find_package)
  
  
  nrf9160dk_nrf9160ns.dts.pre.tmp:357.32-361.5: Warning (simple_bus_reg): /soc/cryptocell-sw: missing or empty reg/ranges property
  nrf9160dk_nrf9160ns.dts.pre.tmp:56.42-68.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@40000000/kmu@39000)
  nrf9160dk_nrf9160ns.dts.pre.tmp:305.19-311.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@40000000/power@5000)
  CMake Error at /home/kadal/Nordic-Tools/ncs/zephyr/cmake/kconfig.cmake:110 (add_custom_target):
    add_custom_target cannot create target "menuconfig" because another target
    with the same name already exists.  The existing target is a custom target
    created in source directory "/home/kadal/Nordic-Tools/projects/microphone".
    See documentation for policy CMP0002 for more details.
  Call Stack (most recent call first):
    /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake:591 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:9 (find_package)
  
  
  CMake Error at /home/kadal/Nordic-Tools/ncs/zephyr/cmake/kconfig.cmake:110 (add_custom_target):
    add_custom_target cannot create target "guiconfig" because another target
    with the same name already exists.  The existing target is a custom target
    created in source directory "/home/kadal/Nordic-Tools/projects/microphone".
    See documentation for policy CMP0002 for more details.
  Call Stack (most recent call first):
    /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake:591 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:9 (find_package)
  
  
  CMake Error at /home/kadal/Nordic-Tools/ncs/zephyr/cmake/kconfig.cmake:110 (add_custom_target):
    add_custom_target cannot create target "hardenconfig" because another
    target with the same name already exists.  The existing target is a custom
    target created in source directory
    "/home/kadal/Nordic-Tools/projects/microphone".  See documentation for
    policy CMP0002 for more details.
  Call Stack (most recent call first):
    /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake:591 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:9 (find_package)
  
  
  CMake Error at /home/kadal/Nordic-Tools/ncs/zephyr/cmake/kconfig.cmake:110 (add_custom_target):
    add_custom_target cannot create target "menuconfig_ses" because another
    target with the same name already exists.  The existing target is a custom
    target created in source directory
    "/home/kadal/Nordic-Tools/projects/microphone".  See documentation for
    policy CMP0002 for more details.
  Call Stack (most recent call first):
    /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake:591 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:9 (find_package)
  
  
  
  error: SB_VALIDATION_INFO_CRYPTO_ID (defined at /home/kadal/Nordic-
  Tools/ncs/nrf/subsys/bootloader/bl_validation/Kconfig:28) is assigned in a configuration file, but
  is not directly user-configurable (has no prompt). It gets its value indirectly from other symbols.
  See http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_SB_VALIDATION_INFO_CRYPTO_ID.html
  and/or look up SB_VALIDATION_INFO_CRYPTO_ID in the menuconfig/guiconfig interface. The Application
  Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of
  the manual might be helpful too.
  
  CMake Error at /home/kadal/Nordic-Tools/ncs/zephyr/cmake/kconfig.cmake:239 (message):
    command failed with return code: 1
  Call Stack (most recent call first):
    /home/kadal/Nordic-Tools/ncs/zephyr/cmake/app/boilerplate.cmake:591 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /home/kadal/Nordic-Tools/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:9 (find_package)
  
  
  
  error: cmake failed
  create_nordic_project.py failed (1)
I am not able to find what is causing the error. Kindly check and guide me to solve the errors and also help me to specify pins as per my circuit for microphone give me syntex to define i2s pins in overlay file. 

Parents
  • Hi,

     

    Do you require to use the PDM interface, or the I2S interface?

    The example you're looking at uses I2S, not PDM. Do note that zephyr doesn't have a nrf-specific port for either PDM or I2S.

    You can use the nrfx driver directly, but this means that you cannot rely on zephyrs sensor-implementations for the specific peripheral. 

     

    If you are interested in PDM, you can have a look at this thread:

    https://devzone.nordicsemi.com/f/nordic-q-a/57896/pdm-interface

     

    Kind regards,

    Håkon

  • sir 

    i tried as per your guide here are my observations

    1. First thing is to add the sources in zephyr/ext/hal/nordic/CMakeLists.txt:
    
    zephyr_sources_ifdef(CONFIG_NRFX_PDM nrfx/drivers/src/nrfx_pdm.c)

    i checked out my ncs v 1.4.0 the file i found at location ncs/modules/hal/nordic/CMakeLists.txt which contains the setting as discussed above

    2. And you also need to add these two lines to zephyr/ext/hal/nordic/Kconfig:
    config NRFX_PDM
        bool

    i didnt find the second file location so can't able to verfy that.

    3. Now we start on the application side. you need to append this to your prj.conf:
        CONFIG_COMPILER_OPT="-DNRF_PDM=NRF_PDM_NS -DNRFX_PDM_ENABLED=1"
        
    4. Next up is selecting the NRFX_PDM in Kconfig. This is a symbol that needs to be selected by a module, so let's add one to your application.
            mainmenu "PDM test"
    
            config FORCE_PDM
            	bool "Test to force PDM"
            	select NRFX_PDM
                default y
            
            source "$ZEPHYR_BASE/Kconfig.zephyr"

    both steps are done correctly

    i also included the code below in main.c as per your saying

    ISR_DIRECT_DECLARE(pdm_isr_handler)
    {
    	nrfx_pdm_irq_handler();
    	ISR_DIRECT_PM(); /* PM done after servicing interrupt for best latency
    			  */
    
    	return 1; /* We should check if scheduling decision should be made */
    }
    
    void main(void)
    {
    	IRQ_DIRECT_CONNECT(PDM_IRQn, 0,
    			   pdm_isr_handler, 0);

    but no luck the code output i got on terminal is like below it got stuck with any function called related to nrfx pdm.

    *** Booting Zephyr OS build v2.4.0-ncs1  ***
    Starting PDM program!
    PDM Buffer size: 3072 in 16 bit words
    pins init!
    

    here is the code i used for tesitng found in some other tickets if that help you to guide me for the error resolution

    /*  
    		C Program to run a pulse density modulation (PDM) Microphone on the nRF9160 Dev Kit using the Nordic SDK
    */
    
    #include <nrf9160.h>
    #include <zephyr.h>
    #include <sys/printk.h>
    #include <string.h>
    #include <stdlib.h>
    #include <nrfx_pdm.h>
    #include <stdint.h>
    #include <drivers/gpio.h>
    
    
    
    #define PDM_BUF_SIZE 3072  //length of buffer in 16 bit words
    
    int16_t pdm_buf[PDM_BUF_SIZE];
    
    void nrfx_pdm_event_handler(nrfx_pdm_evt_t const *const p_evt)
    {
    	if (p_evt->buffer_requested) {
    		nrfx_pdm_buffer_set(pdm_buf, PDM_BUF_SIZE);
    	}
    	if (p_evt->buffer_released != 0) {
    		printk("Out: %4x @ 0x%x\r\n %4x @ 0x%x\r\n",
    		       (uint16_t)pdm_buf[0], &pdm_buf[0],
    		       (uint16_t)pdm_buf[1], &pdm_buf[1]);
    	}
    }
    
    static void pdm_init(void)
    {
    	nrfx_pdm_config_t pdm_config = NRFX_PDM_DEFAULT_CONFIG(
    		1, 0); /*configures CLK to pin 01 and Din to pin 00*/
                    printk("pins init!\n");
    	int err = nrfx_pdm_init(&pdm_config, nrfx_pdm_event_handler);
            printk("%u\n",err);
    }
    
    /*ISR workaround given by Nordic*/
    ISR_DIRECT_DECLARE(pdm_isr_handler)
    {
    	nrfx_pdm_irq_handler();
    	ISR_DIRECT_PM(); /* PM done after servicing interrupt for best latency
    			  */
    
    	return 1; /* We should check if scheduling decision should be made */
    }
    
    void main(void)
    {
    	IRQ_DIRECT_CONNECT(PDM_IRQn, 0, pdm_isr_handler, 0);  //workaround line 
    	printk("Starting PDM program!\n");
    	printk("PDM Buffer size: %d in 16 bit words\n", PDM_BUF_SIZE);
    
    	/*
    	bool enabled = nrfx_pdm_enable_check();
    	printk(enabled ? "true/n" : "false\n");
    	*/
    
    	pdm_init();
    	printk("%4x is the starting address\n", &pdm_buf);
    	printk("%4x is current value at %x\n", pdm_buf[0], &pdm_buf);
    	printk("The PDM will start reading NOW...\n");
          /*  for (int i = 0; i < 500; i++) {
              int k = 5;
              for (volatile int j = 0; j < 50; j++) {
                    k = !k;
    		}
    	}*/
    	nrfx_pdm_start();
    	for (int i = 0; i < 100; i++) {
              int k = 5;
              for (volatile int j = 0; j < 100; j++) {
                    k = !k;
    		}
    	}
    	nrfx_pdm_stop();
    
    	printk("%4x is current value at %x\n", pdm_buf[0], &pdm_buf);
    }

    i am also including my proj.conf

    CONFIG_PRINTK=y
    CONFIG_I2C=y
    CONFIG_GPIO=y
    CONFIG_NRFX_PDM=y
    
    CONFIG_DEBUG=y 
    #CONFIG_REBOOT=n
    
    CONFIG_COMPILER_OPT="-DNRF_PDM=NRF_PDM_NS -DNRFX_PDM_ENABLED=1"
    
    

    please go through all the details and help me to resolve the error.

  • My apologies, the peripheral needs to be marked as non-secure in spm.c, as shown here:

    https://devzone.nordicsemi.com/f/nordic-q-a/68472/pdm-mic-on-nrf9160dk-and-spm/281880#281880

    Could you try this and see if it works better now?

     

    Kind regards,

    Håkon

  • thanks for quick reply. i followed the link and set the values as described to spm.c now the pdm functions are working but still in dts file pdm shows disabled as below

    pdm0: pdm@26000 {
    				compatible = "nordic,nrf-pdm";
    				reg = < 0x26000 0x1000 >;
    				interrupts = < 0x26 0x1 >;
    				status = "disabled";
    				label = "PDM_0";
    			};

    i also included nrfx.h which includes nrfx_config.h which clearly showing the value NRFX_PDM_ENABLED 1.

    i am using function 

    bool enabled = nrfx_pdm_enable_check();
    	printk(enabled ? "true/n" : "false\n");

    which gives false as output. inspite all this the output i got is like this

    *** Booting Zephyr OS build v2.4.0-ncs1  ***
    Starting PDM program!
    PDM Buffer size: 3072 in 16 bit words
    false
    pins init!
    195887104
    false
    200101d8 is the starting address
       0 is current value at 200101d8
    The PDM will start reading NOW...
    Out:    0 @ 0x200101d8
        0 @ 0x200101da
    Out:    0 @ 0x200101d8
        0 @ 0x200101da
       0 is current value at 200101d8
    

    i was trying to find out the reason that which file is over writing the pdm enable configuration. i am again including the proj.conf settings below

    CONFIG_PRINTK=y
    CONFIG_I2C=y
    CONFIG_GPIO=y
    CONFIG_NRFX_PDM=y
    
    CONFIG_DEBUG=y 
    #CONFIG_REBOOT=n
    
    CONFIG_COMPILER_OPT="-DNRF_PDM=NRF_PDM_NS -DNRFX_PDM_ENABLED=1"
    
    
    

    kindly check into this and help me to resolve the issue as explained before i am using a custom pcb with conf nrfx_pdm_config_t pdm_config = NRFX_PDM_DEFAULT_CONFIG(1, 0); . please guide me to resolve the issue.

  • Hi,

     

    As mentioned, you only need to set the config NRFX_PDM=y and set the peripheral as non-secure in spm.c, no need to add the CONFIG_COMPILER_OPT="..." with ncs v1.4.0 and newer.

     

    Y0g1 said:
    i followed the link and set the values as described to spm.c now the pdm functions are working but still in dts file pdm shows disabled as below

    DT does not have any impact when using the nrfx driver directly. You are accessing the hardware peripheral directly without using the zephyr driver API. 

     

    Y0g1 said:
    which gives false as output. inspite all this the output i got is like this

     This function will only return true if the PDM is started, not initialized. Try checking this after you call nrfx_pdm_start().

     

    Y0g1 said:
    which gives false as output. inspite all this the output i got is like this

     Can you try to let the PDM run for 1 second before stopping it? Like this:

    	nrfx_pdm_start();
    	bool enabled = nrfx_pdm_enable_check();
    	printk(enabled ? "true/n" : "false\n");	
    	k_msleep(1000);
    
    	nrfx_pdm_stop();

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    As mentioned, you only need to set the config NRFX_PDM=y and set the peripheral as non-secure in spm.c, no need to add the CONFIG_COMPILER_OPT="..." with ncs v1.4.0 and newer.

     

    Y0g1 said:
    i followed the link and set the values as described to spm.c now the pdm functions are working but still in dts file pdm shows disabled as below

    DT does not have any impact when using the nrfx driver directly. You are accessing the hardware peripheral directly without using the zephyr driver API. 

     

    Y0g1 said:
    which gives false as output. inspite all this the output i got is like this

     This function will only return true if the PDM is started, not initialized. Try checking this after you call nrfx_pdm_start().

     

    Y0g1 said:
    which gives false as output. inspite all this the output i got is like this

     Can you try to let the PDM run for 1 second before stopping it? Like this:

    	nrfx_pdm_start();
    	bool enabled = nrfx_pdm_enable_check();
    	printk(enabled ? "true/n" : "false\n");	
    	k_msleep(1000);
    
    	nrfx_pdm_stop();

     

    Kind regards,

    Håkon

Children
Related