Showing results for 
Search instead for 
Did you mean: 

How to configure DFSDM data resolution and how does right bit shift affect?



I'm currently working in a project with the Nucleo-L476RG board. Basically, I have a MEMS microphone (AN-000048) connected to the board. The microphone (I pretend to work in stereo mode) sends PDM data and I use the DFSDM module get the microphone data in PCM format.

My problem comes with the DFSDM module configuration. By consulting documentation and videos about the module, I've arrived at some conclusions, which I use to configure the module:

  • The clock frequency that is sent to the microphone is the Output Clock. I've configured the clock to use the system clock as source (80MHz) with a 125 divider, so I'm sending a 640KHz signal to the microphone.
  • I use channel 0 with PDM/SPI input from ch0 and internal clock mode.
  • I use DMA from peripheral to memory with word data width and in circular mode (which, as far as i know, involves that once the buffer is full, new data is written at the beginning of the buffer)
  • I use the Filter0 with regular data injection from channel 0 in continuous mode and I have enabled both DMA and fast mode. I use a Sinc3 filter with Fosr = 16 and Iosr = 1. As far as I know and using table 159 from the RM0351, this involves that I have values between +/- 2^(log2(16^3)) = +/- 4096. That's 12 bits + 1 bit for the sign.

The values I get in the buffer that DFSDM uses for storing the data aren't in this range. However, I've read that the resolution of the DFSDM is up to 31 bits but the resolution of the output data is only up to 24 bits. I really don't understand this, but I suppose that I haven't to be concerned about that because I use 13 bits. I also asume that the right bit shift option is for cases where the DFSDM resolution is grater than 24 bits. Am I correct?

Regardless, if I get rid of the 8 LSB of the buffer, so i get the 24 bits that are the actual data (not quite sure about that), I don't get the resolution I expect.

Can someone please help me to understand how to set the resolution of the DFSDM data and what is the right bit shift for? What should I expect to see in the buffer that DFSDM uses to write? I've searched but I can't find any resource that helps me to understand how does it work or that leads me to the error that I'm doing (because I assume that if the data is not in the +/- 4096 range is because I'm doing something wrong).

Any help is appreciated! Also forgive me if i've done one or several gramatical/ortographic errors, english is not my first language.