cancel
Showing results for 
Search instead for 
Did you mean: 

No CLKOUT DFSDM1 on STM32MP, cannot record with ARECORD

robin_elecgator
Associate II

When loading the device tree below, I see the soundcard in alsa. But I don't see any clock out for the microphones, and I can't record from this device. The devices tree is almost a 1 to 1 copy of the example.

What small thing do I over look?

Arecord -L output

null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default
    Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=smartMic
    smartMic,
    Default Audio Device

Arecord --dump-hw-params -f dat

Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
HW Params of device "sysdefault:CARD=smartMic":
--------------------
ACCESS:  MMAP_INTERLEAVED MMAP_NONINTERLEAVED MMAP_COMPLEX RW_INTERLEAVED RW_NONINTERLEAVED
FORMAT:  S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE MU_LAW A_LAW IMA_ADPCM S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE
SUBFORMAT:  STD
SAMPLE_BITS: [4 64]
FRAME_BITS: [4 640000]
CHANNELS: [1 10000]
RATE: [4000 4294967295)
PERIOD_TIME: (31 64000]
PERIOD_SIZE: (0 274877907)
PERIOD_BYTES: (0 4294967295)
PERIODS: (0 4294967295]
BUFFER_TIME: [1 4294967295]
BUFFER_SIZE: [1 1649267441]
BUFFER_BYTES: [1 4294967295]
TICK_TIME: ALL
--------------------
arecord: set_params:1403: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 48000
PERIOD_TIME: 16000
PERIOD_SIZE: 768
PERIOD_BYTES: 3072
PERIODS: 6
BUFFER_TIME: 96000
BUFFER_SIZE: 4608
BUFFER_BYTES: 18432
TICK_TIME: 0

Soundcard config:

sound_card {
		compatible = "audio-graph-card";
		label = "smartMic";
		dais = <&dfsdm0_port &dfsdm1_port>;
	};
dmic0: dmic-0 {
		compatible = "dmic-codec";
		#sound-dai-cells = <1>;
		status = "okay";
 
		port {
			dmic0_endpoint: endpoint {
				remote-endpoint = <&dfsdm_endpoint0>;
			};
		};
	};
 
dmic1: dmic-1 {
		compatible = "dmic-codec";
		#sound-dai-cells = <1>;
		status = "okay";
 
		port {
			dmic1_endpoint: endpoint {
				remote-endpoint = <&dfsdm_endpoint1>;
			};
		};
	};

PinMux:

 dfsdm_pins_mx: dfsdm_mx-0 {
        pins1 {
            pinmux = <STM32_PINMUX('C', 1, AF3)>, /* DFSDM1_DATIN0 */
                     <STM32_PINMUX('C', 3, AF3)>; /* DFSDM1_DATIN1 */
            bias-disable;
        };
        pins2 {
            pinmux = <STM32_PINMUX('B', 13, AF3)>; /* DFSDM1_CKOUT */					
            bias-disable;
            drive-push-pull;
            slew-rate = <1>;
        };
    };

DFSDM config

&dfsdm{
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&dfsdm_pins_mx>;
    pinctrl-1 = <&dfsdm_sleep_pins_mx>;
    status = "okay";
 
    /* USER CODE BEGIN dfsdm */
		spi-max-frequency = <4080000>;
 
	clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
	clock-names = "dfsdm", "audio";
	status = "okay";
	dfsdm0: filter@0 {
		compatible = "st,stm32-dfsdm-dmic";
		st,adc-channels = <0>;
		st,adc-channel-names = "dmic_u1";
		st,adc-channel-types = "SPI_R";
		st,adc-channel-clk-src = "CLKOUT";
		st,filter-order = <3>;
		status = "okay";
 
		asoc_pdm0: dfsdm-dai {
			compatible = "st,stm32h7-dfsdm-dai";
			#sound-dai-cells = <0>;
			io-channels = <&dfsdm0 0>;
			status = "okay";
 
			dfsdm0_port: port {
				#sound-dai-cells = <0>;
				dfsdm_endpoint0: endpoint {
					remote-endpoint = <&dmic0_endpoint>;
				};
			};
		};
	};
 
	dfsdm1: filter@1 {
		compatible = "st,stm32-dfsdm-dmic";
		st,adc-channels = <0>;
		st,adc-channel-names = "dmic_u2";
		st,adc-channel-types = "SPI_F";
		st,adc-channel-clk-src = "CLKOUT";
		st,filter-order = <3>;
		status = "okay";
 
		asoc_pdm1: dfsdm-dai {
			compatible = "st,stm32h7-dfsdm-dai";
			#sound-dai-cells = <0>;
			io-channels = <&dfsdm1 0>;
			status = "okay";
 
			dfsdm1_port: port {
				#sound-dai-cells = <0>;
				dfsdm_endpoint1: endpoint {
					remote-endpoint = <&dmic1_endpoint>;
				};
			};
		};
	};
    /* USER CODE END dfsdm */
};

1 REPLY 1
Olivier GALLIEN
ST Employee

Hi @robin_elecgator​ 

dfsdm record via pulse audio you are trying is not yet supported.

Please refer to https://wiki.st.com/stm32mpu/wiki/How_to_record_audio

Hope it help,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.