2018-05-23 01:11 AM
Hello !
I am currently working on an audio application on STM32F7-discovery.
The example application is recording in stereo from the 2 MEMS microphones regardless of the parameters sent to :
BSP_AUDIO_IN_Init
I am now using my own application , but the behavior is the same , always stereo.
I suspected that it was because the codec initialization code in wm8994.c was turning on both channels when the input device specified is : INPUT_DEVICE_DIGITAL_MICROPHONE_2
So i changed the initialization of INPUT_DEVICE_DIGITAL_MICROPHONE_2 to only initialize the right channel and disable the left one In order to get a mono output from the wm8994.
case
INPUT_DEVICE_DIGITAL_MICROPHONE_2 :/* Enable AIF1ADC2 (Left), Enable AIF1ADC2 (Right)
* Enable DMICDAT2 (Left), Enable DMICDAT2 (Right)
* Enable Left ADC, Enable Right ADC */
//counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0C30);
counter+=
CODEC_IO_Write(DeviceAddr,0x04
,0x0410
);/* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC2 Left/Right Timeslot 1 */
//counter += CODEC_IO_Write(DeviceAddr, 0x450, 0x00DB);
counter+=
CODEC_IO_Write(DeviceAddr,0x450
,0x00D9
);/* Disable IN1L, IN1R, IN2L, IN2R, Enable Thermal sensor & shutdown */
counter+=
CODEC_IO_Write(DeviceAddr,0x02
,0x6000
);/* Enable the DMIC2(Left) to AIF1 Timeslot 1 (Left) mixer path */
//counter += CODEC_IO_Write(DeviceAddr, 0x608, 0x0002);
counter+=
CODEC_IO_Write(DeviceAddr,0x608
,0x0000
);/* Enable the DMIC2(Right) to AIF1 Timeslot 1 (Right) mixer path */
counter+=
CODEC_IO_Write(DeviceAddr,0x609
,0x0002
);/* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC2 signal detect */
counter+=
CODEC_IO_Write(DeviceAddr,0x700
,0x000E
);break
;I have indeed the left channel constantly at 0 so it is disabled , but the samples are still received.
I would like to receive only the RIGHT channel samples, is this even possible ? I assumed that it is but maybe not..
I don't know if this is a DMA configuration error or another setting that i cannot find in the
http://www.mouser.com/ds/2/76/WM8994_v4.4-532439.pdf
.If i understand correctly the two MEMS microphones share the same clock and data line the wm8994 is reading at both rising and falling edge on the data line , where each microphone alternately 'send' it's PDM sample.
I looked for a way to read only on one edge on the wm8994 but without success so far.
My apologies if i missed something obvious, for now I only take the odd samples from the received buffer but i believe that a much cleaner solution is possible ?
Thanks in advance for any help !
#stm32f7 #stm32f7-audio2018-05-23 02:29 AM
Hi
hroussille
,Do you try to have a look to the audio application under the STM32F7 package, it may be helpful :
STM32Cube_FW_F7_V1.0\Projects\STM32746G-Discovery\Applications\Audio\Audio_playback_and_record
This application shows how to use the different functionalities of Audio device and ST MEMS microphones (MP45DT02), use touch screen to enter into playback or record menu.
-Nesrine-
2018-05-23 03:58 AM
Hi !
Thank you for your answer !
Yes my application is mostly inspired of it.
But even on this application demo application the recorded audio is stereo even when changing :
DEFAULT_AUDIO_IN_CHANNEL_NBR which is passed as parameter to BSP_AUDIO_IN_Init.
I have the same problem in my custom application that is why i started changing the driver.