i.MX8MP pdm micfil - DC remover cut-off frequency issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8MP pdm micfil - DC remover cut-off frequency issue

1,004 Views
kjelloverote
Contributor I

Dear NXP team,

We are working with a custom board with 4 digital mics connected to the pdm micfil input.

We have some challenges with the DC-Remover high-pass filter block in the decimation filter.
So, the DC-remover part is ok (we get DC offset when doing filter bypass and we can remove it), but the register settable cut-off frequencies (21Hz, 83Hz, 152Hz) we can not see are working.

We are using this kernel driver
https://github.com/varigit/linux-imx/blob/5.15-2.0.x-imx_var01/sound/soc/fsl/fsl_micfil.c
with some modifications the the RANGEADJn register based on this commit:
https://github.com/nxp-imx/linux-imx/commit/7daafbd2d93417c826d9ca5e03aa12e493ba10ba

We are a bit uncertain on this point in the manual, and if we really need to run this sequence changing the DC offset reg or not?

kjelloverote_0-1695106943815.png

We have tested implementing the sequence in the driver setting when the register with no luck. Also tested hard-coding cut-off frequency in driver probe etc, still no luck.

One test case below running 16 kHz and Quality mode medium.

# arecord --dump-hw-params -D plughw:CARD=vectoraudiomicf -c 4 -r 16000 -f S32_LE --vumeter=mono /tmp/micf4.wav

Signal and frequency analyzes when recorded in a relatively silent room (about 47 dBA room/ventilation noise). With a filter cut-off at 152 HZ we would expect a different result.

kjelloverote_1-1695107375183.png

Best regards
Kjell Ove

0 Kudos
Reply
5 Replies

929 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hello @kjelloverote,

I hope you are doing well.

->The RANGEADJn register controls the cutoff frequency of the DC-remover high-pass filter block in the decimation filter.
->Please make sure to check the values for 21Hz, 83Hz, and 152Hz are defined in the fsl_micfil.h header file.

->Please make sure to write the appropriate value to the register in order to use the RANGEADJn register
->Please make sure that the decimation filter is enabled.
->Please make sure to check the hardware registers to make sure that the filter is configured correctly.

If possible please try using the latest kernel as it offers the latest drivers as well as firmware.

I hope this helps!

Thanks & Regards,
Sanket Parekh

0 Kudos
Reply

880 Views
kjelloverote
Contributor I

Hello @Sanket_Parekh 

Thank you for feedback.

We will look more into your suggestions, but on the RANGEADJn register maybe you have some more clarification for us?

We have already been experimenting with a variety of register values here, and attempted calculating according to reference manual.

With the formulas in the ref manual (using Quality Select Medium), we find the RANGEADJn value should be <= -1, and we have some idea we would like a overall gain about -24 dB giving a RANGEADJn of -5.

kjelloverote_0-1695646298376.png

We have some challenge however to really understanding how to map this to the four bit RANGEADJn  
The manual says:

«adjusts the dynamic range of the CIC filter. It is a unsigned positive value. This bitfield must be set within the following ranges:»

But the number we get from the formulas is a negative number. Think I once read that sign in controller is handled as two's complement, but not sure about this. I can also not make this really match with my observations.
So, -5 with signed two's complement should, with a 4-bit reg, be value 0xB(?)

By experimenting we find RANGADJn around 0x7 gives us best/descent mic signal level (apart from filter not working)
I confirm reg value with command:

# cat /sys/kernel/debug/regmap/30ca0000.micfil/registers | grep 74:
74: 77777777

DC remover cut-off at 152 Hz:

# cat /sys/kernel/debug/regmap/30ca0000.micfil/registers | grep 64:
64: 0000aaaa

Micfil control reg1  (PDMIEN=1):

# cat /sys/kernel/debug/regmap/30ca0000.micfil/registers | grep 00:
00: 2900000f

Micfil control reg2  (Medium Quality):

# cat /sys/kernel/debug/regmap/30ca0000.micfil/registers | grep 04:
04: 0000000c

Thanks & Regards,

Kjell Ove Røte

0 Kudos
Reply

827 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hello @kjelloverote,

I hope you are doing well.

There is not much information available But one can refer to these links for reference.

https://community.nxp.com/t5/i-MX-Processors/IMX8MP-PDM-Microphone-SPH0641LM4H-1/m-p/1311380
https://www.kernel.org/doc/Documentation/devicetree/bindings/sound/fsl%2Cmicfil.yaml

Can you share the reference manual that you are referring to?

Thanks & Regards,
Sanket Parekh

0 Kudos
Reply

812 Views
kjelloverote
Contributor I

Hello @Sanket_Parekh 

I was referring to the i.MX 8M Plus Applications Processor Reference Manual

Chapter 14.3.6.9.3 describes the RANGEADJ register with the description It is a unsigned positive value, but formulas may produce negative numbers.

kjelloverote_0-1695922320904.png

Thanks & Regards,
Kjell Ove Røte

0 Kudos
Reply

786 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hello @kjelloverote,

I hope you are doing well.

Please accept my apology for the delayed response.

"but formulas may produce negative numbers."
->This value can be unsigned positive as written in the RM, but one has to follow the below-given conditions, SO please check whether these conditions match with yours or not.

If QSEL in [HQ,LQ]: RANGEADJn <= 27 − ceil 7log2 32 − 2CICOSR))
If QSEL in [MQ,VLQ1]: RANGEADJn <= 27 − ceil 7log2 16−CICOSR))
If QSEL in [LQ,VLQ2]: RANGEADJn <= 26 − ceil 7log2 16−CICOSR

Where OSR = 16-CICOSR

Please make sure of the below things.

->In order to get a better audio performance, the RANGEADJn bitfield needs to be adjusted depending on the quality mode selected as pointed out in its description. For more information, refer to Overall Filter Gain.

Thanks & Regards,
Sanket Parekh

0 Kudos
Reply