Skip to main content
Explorer
November 18, 2019
Question

Error when using STM32MP157C-EV1 Dmic with S16_LE format

  • November 18, 2019
  • 1 reply
  • 1337 views

Hi all,

I am using a STM32MP157C-EV1 and testing the digital microphones with ALSA. For testing purposes I am just using the arecord command. All works fine if I use the S32_LE sample format:

$ arecord -D hw:0,4 -f S32_LE /tmp/rec.wav               

Recording WAVE '/tmp/rec.wav' : Signed 32 bit Little Endian, Rate 8000 Hz, Mono 

For my application I need to use S16_LE. Since this is not natively supported by the driver, I try to use an ALSA "plughw" device to do the conversion, but that fails:

$ arecord -D plughw:0,4 -f S16_LE /tmp/rec.wav             

Recording WAVE '/tmp/rec.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono 

arecord: set_params:1361: Unable to install hw params:             

ACCESS: RW_INTERLEAVED                             

FORMAT: S16_LE                                 

SUBFORMAT: STD                                 

SAMPLE_BITS: 16                                 

FRAME_BITS: 16                                 

CHANNELS: 1                                   

RATE: 8000                                   

PERIOD_TIME: 64000                               

PERIOD_SIZE: 512                                

PERIOD_BYTES: 1024                               

PERIODS: 6                                   

BUFFER_TIME: 384000                               

BUFFER_SIZE: 3072                                

BUFFER_BYTES: 6144                               

TICK_TIME: 0 

This typically means that the (native) driver is reporting a set of supported parameters, but not all combinations are actually supported (so when the plughw device tries to configure the driver, an error occurs).

Any hint on how to solve this?

Guillermo

    This topic has been closed for replies.

    1 reply

    ST Employee
    November 18, 2019

    Hi !

    MMDV-1.0.0 doesn't support DSFDM record in 16 bits, but MMDV-1.1.0 is.

    You can cross-check it by having a look into sound/soc/stm/stm32_adfsdm.c:49 where you should find the following line:

    .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE,

    The following command worked fine on my side :

    arecord -D record_dfsdm0 -r 16000 -f S16_LE -c 1 -d 5 /tmp/file.wav

    BR,

    Christophe

    Explorer
    November 18, 2019

    Hi Christophe,

    Thank you for your answer. Not sure what "MMDV" is, can you clarify ?

    Anyway: Note that even if the driver (stm32_adfsdm) didn't support S16_LE natively, I am using the ALSA "plughw" plug-in, which should automatically handle any sample format conversions.

    The fact that this does not work probably means that the driver is advertising capabilities that is not actually supporting (thus plughw end up trying to configure the driver with an unsupported hw param set)

    You can just try any other format, the error is the same:

    arecord -D plughw:0,4 -f U8 /tmp/rec.wav

    Any idea what might be wrong?

    Guillermo