<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>understanding PDM gain</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/104004/understanding-pdm-gain</link><description>Dear Nordic, In our application, we use nRF52840 (nRF5 SDK) and a PDM microphone to listen to the very quiet signals. We would like to understand how exactly gain works. I could not find more information than this: https://infocenter.nordicsemi.com/index</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 Nov 2023 10:16:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/104004/understanding-pdm-gain" /><item><title>RE: understanding PDM gain</title><link>https://devzone.nordicsemi.com/thread/457117?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2023 10:16:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb06134d-6164-4555-9b00-8bd3bf3db466</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span&gt;The gain set in the register will alter the numerical value for each sampling.&amp;#39;&amp;#39; -It&amp;#39;s a straightforward&amp;nbsp;gain stage that amplifies or attenuates the signal, which is a multiplication of the gain value with each individual sample which then results in larger or smaller represented swing.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The&amp;nbsp;filter&amp;nbsp;stage&amp;nbsp;of&amp;nbsp;each&amp;nbsp;channel&amp;nbsp;is&amp;nbsp;followed&amp;nbsp;by&amp;nbsp;a&amp;nbsp;digital&amp;nbsp;volume&amp;nbsp;control,&amp;nbsp;to&amp;nbsp;attenuate&amp;nbsp;or&amp;nbsp;amplify&amp;nbsp;the&amp;nbsp;output&amp;nbsp;samples&amp;nbsp;in&amp;nbsp;a&amp;nbsp;range&amp;nbsp;of&amp;nbsp;-20&amp;nbsp;dB&amp;nbsp;to&amp;nbsp;+20&amp;nbsp;dB&amp;nbsp;around&amp;nbsp;the&amp;nbsp; default&amp;nbsp;(reset)&amp;nbsp;setting,&amp;nbsp;defined&amp;nbsp;by&amp;nbsp;GPDM,default.&amp;nbsp;The&amp;nbsp;gain&amp;nbsp;is&amp;nbsp;controlled&amp;nbsp;by&amp;nbsp;the&amp;nbsp;GAINL&amp;nbsp;and&amp;nbsp;GAINR&amp;nbsp;registers.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;As&amp;nbsp;an&amp;nbsp;example,&amp;nbsp;if&amp;nbsp;the&amp;nbsp;goal&amp;nbsp;is&amp;nbsp;to&amp;nbsp;achieve&amp;nbsp;2500&amp;nbsp;RMS&amp;nbsp;output&amp;nbsp;samples&amp;nbsp;(16&amp;nbsp;bit)&amp;nbsp;with&amp;nbsp;a&amp;nbsp;1&amp;nbsp;kHz&amp;nbsp;90&amp;nbsp;dBA&amp;nbsp;signal&amp;nbsp;into&amp;nbsp;a&amp;nbsp;-26&amp;nbsp;dBFS&amp;nbsp;sensitivity&amp;nbsp;PDM&amp;nbsp;microphone,&amp;nbsp;the&amp;nbsp;user will&amp;nbsp;have&amp;nbsp;to&amp;nbsp;sum&amp;nbsp;the&amp;nbsp;PDM&amp;nbsp;module&amp;#39;s&amp;nbsp;default&amp;nbsp;gain&amp;nbsp;(&amp;nbsp;GPDM,default&amp;nbsp;)&amp;nbsp;and&amp;nbsp;the&amp;nbsp;gain&amp;nbsp;introduced&amp;nbsp;by&amp;nbsp;the&amp;nbsp;microphone&amp;nbsp;and&amp;nbsp;acoustic&amp;nbsp;path&amp;nbsp;of&amp;nbsp;his&amp;nbsp;implementation&amp;nbsp;(an attenuation&amp;nbsp;would&amp;nbsp;translate&amp;nbsp;into&amp;nbsp;a&amp;nbsp;negative&amp;nbsp;gain),&amp;nbsp;and&amp;nbsp;adjust&amp;nbsp;GAINL&amp;nbsp;and&amp;nbsp;GAINR&amp;nbsp;by&amp;nbsp;this&amp;nbsp;amount.&amp;nbsp;Assuming&amp;nbsp;that&amp;nbsp;only&amp;nbsp;the&amp;nbsp;PDM&amp;nbsp;module&amp;nbsp;influences&amp;nbsp;the&amp;nbsp;gain,&amp;nbsp; GAINL&amp;nbsp;and&amp;nbsp;GAINR&amp;nbsp;must&amp;nbsp;be&amp;nbsp;set&amp;nbsp;to&amp;nbsp;-GPDM,default&amp;nbsp;dB&amp;nbsp;to&amp;nbsp;achieve&amp;nbsp;the&amp;nbsp;requirement.&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;With&amp;nbsp;GPDM,default=3.2&amp;nbsp;dB,&amp;nbsp;and&amp;nbsp;as&amp;nbsp;GAINL&amp;nbsp;and&amp;nbsp;GAINR&amp;nbsp;are&amp;nbsp;expressed&amp;nbsp;in&amp;nbsp;0.5&amp;nbsp;dB&amp;nbsp;steps,&amp;nbsp;the&amp;nbsp;closest&amp;nbsp;value&amp;nbsp;to&amp;nbsp;program&amp;nbsp;would&amp;nbsp;be&amp;nbsp;3.0&amp;nbsp;dB,&amp;nbsp;which&amp;nbsp;can&amp;nbsp;be&amp;nbsp;calculated&amp;nbsp;as:&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;GAINL&amp;nbsp;=&amp;nbsp;GAINR&amp;nbsp;=&amp;nbsp;(DefaultGain&amp;nbsp;-&amp;nbsp;(2&amp;nbsp;*&amp;nbsp;3))&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: understanding PDM gain</title><link>https://devzone.nordicsemi.com/thread/454362?ContentTypeID=1</link><pubDate>Tue, 07 Nov 2023 09:02:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5bb726d-3dcf-44c0-90d7-4ce88ad842b8</guid><dc:creator>mjaszczykowski</dc:creator><description>&lt;p&gt;Hello Sultana,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thank you for the long response, unfortunately, it does not tell me about the mathematical operations happening there.&lt;br /&gt;&lt;br /&gt;Could you please answer my original question?&lt;/p&gt;
[quote userid="121473" url="~/f/nordic-q-a/104004/understanding-pdm-gain/450232"]What do you mean by &lt;strong&gt;alter in mathematical terms&lt;/strong&gt;?&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;Is it multiplication for a gain greater than zero?[/quote]
&lt;p&gt;Could you also elaborate a bit more on your initial statement?&lt;/p&gt;
[quote userid="108933" url="~/f/nordic-q-a/104004/understanding-pdm-gain/447261"]You can not increase SNR ratio with gain.[/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: understanding PDM gain</title><link>https://devzone.nordicsemi.com/thread/451543?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2023 15:34:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1599fe19-f585-4ae6-9a65-2c58dcce3cae</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;#39;&amp;#39;&lt;span&gt;The gain set in the register will alter the numerical value for each sampling.&amp;#39;&amp;#39; This is one of the mechanisms&amp;nbsp;inside the PDM module.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Bits from the left PDM microphone are sampled on the falling edge of clock and right bits are sample on the rising edge of clk, resulting in two bitstreams.&amp;nbsp;Each bitstream is fed into a digital filter which converts the PDM stream into 16-bit PCM samples, and filters and down-samples them to reach the appropriate sample rate.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The EDGE field in the MODE register allows swapping Left and Right, so that Left will be sampled on rising edge, and right&amp;nbsp;on falling.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Depending on the mode chosen in the OPERATION field in the MODE register, memory either contains alternating left and right 16-bit samples (Stereo), or only left 16-bit samples (Mono).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In order to convert the incoming data stream into PCM audio samples, a decimation filter is included in the PDM interface module. input of the filter is those serial streams&amp;nbsp;from left and right channel. There is a term called decimation&amp;nbsp;factor. This is defined as M. if the value of M is 80, then after computing the first sample, PDM to PCM block will compute the 80th sample.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;if you want a 16 kHz PCM rate, you should choose a PDM clock rate of 1.28 MHz, and a decimation factor of 80.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can watch this video&amp;nbsp;&lt;a href="https://www.youtube.com/watch?v=5lH-tQw0tlU"&gt;(1) STM32 Microphone Audio Acquisition: Part 3, PDM to PCM Conversion - YouTube&lt;/a&gt;&amp;nbsp;to have in general concept of PDM to PCM conversion.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: understanding PDM gain</title><link>https://devzone.nordicsemi.com/thread/450232?ContentTypeID=1</link><pubDate>Fri, 13 Oct 2023 08:29:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d555f483-a377-4152-9c25-0756cd41bcc8</guid><dc:creator>mjaszczykowski</dc:creator><description>[quote userid="108933" url="~/f/nordic-q-a/104004/understanding-pdm-gain/450104"]The gain set in the register will alter the numerical value for each sampling[/quote]
&lt;p&gt;Thank you very much for your reply.&lt;br /&gt;What do you mean by &lt;strong&gt;alter in mathematical terms&lt;/strong&gt;?&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;Is it multiplication for a gain greater than zero?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: understanding PDM gain</title><link>https://devzone.nordicsemi.com/thread/450104?ContentTypeID=1</link><pubDate>Thu, 12 Oct 2023 14:44:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36513d4a-4e29-4581-acf3-0facce0222b2</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The PDM module of the nRF52832 converts the PDM signal to PCM. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/6445.pastedimage1697119115930v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The gain set in the register will alter the numerical value for each sampling. The sampling rated will be reduced by the oversampling factor. Decimation process is done to accomplish this through a digital filtering operation. The input of the filter is the two-channel PDM serial stream (with left channel on clock high, right channel on clock low). Depending on the RATIO selected, its output is 2 × 16-bit PCM samples at a sample rate either 64 times or 80 times (depending on the RATIO register) lower than the PDM clock rate.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The gain is controlled by&amp;nbsp;GAINL and GAINR registers.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: understanding PDM gain</title><link>https://devzone.nordicsemi.com/thread/449301?ContentTypeID=1</link><pubDate>Mon, 09 Oct 2023 08:35:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46085dab-4337-429d-83a5-2dddf720893c</guid><dc:creator>mjaszczykowski</dc:creator><description>&lt;p&gt;Hello Kazi Afroza Sultana,&lt;br /&gt;&lt;br /&gt;I hope you are well.&lt;br /&gt;&lt;br /&gt;Do we have any update on this one?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: understanding PDM gain</title><link>https://devzone.nordicsemi.com/thread/447862?ContentTypeID=1</link><pubDate>Wed, 27 Sep 2023 06:50:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbae0565-098c-422f-8923-6a7b9dbde4b7</guid><dc:creator>mjaszczykowski</dc:creator><description>&lt;p&gt;Hello Kazi Afroza Sultana,&lt;br /&gt;&lt;br /&gt;Thank you very much for your reply.&lt;br /&gt;&lt;br /&gt;I am looking forward to seeing more details.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: understanding PDM gain</title><link>https://devzone.nordicsemi.com/thread/447261?ContentTypeID=1</link><pubDate>Fri, 22 Sep 2023 13:39:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e783103-fd42-4090-81fd-e2ed7b7e16cf</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Marcin,&lt;/p&gt;
&lt;p&gt;You can not increase SNR ratio with gain. I will explain rest of the queries later on Monday.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;BR&lt;/p&gt;
&lt;p&gt;Kazi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>