<?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>Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70113/issues-in-reading-analog-mic-data-over-saadc-pin-of-nrf52810</link><description>I have an expansion board by ST mounting an analog mic (MP23ABS1). The mic out pin (via a diff. amplifier) is given on a connector. I take that signal and feed it to the AIN5 (P0.29) on nrf52810. I want to continuously sample the analog mic data at 8000Hz</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Jan 2021 07:54:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70113/issues-in-reading-analog-mic-data-over-saadc-pin-of-nrf52810" /><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/290404?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 07:54:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ccbef48-d135-4e7c-b58e-192606d07ccb</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Manish&lt;/p&gt;
&lt;p&gt;The slower the sample rate the larger the relative difference will be, since it is the sleep currents (not the active currents) that is most affected by running a timer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to compare the two you could always use the app_timer itself to sample the ADC, as long as the frequency is not too large. At 1kHz or lower the app_timer should be able to schedule callbacks fast enough.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then you can compare the current consumption either when using the app_timer or when using a TIMER module, and see if it is big enough to warrant concern.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/290135?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2021 08:18:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f2fca29-b111-49ae-9dee-3f71b2eb3020</guid><dc:creator>Manish Kaul</dc:creator><description>[quote userid="2116" url="~/f/nordic-q-a/70113/issues-in-reading-analog-mic-data-over-saadc-pin-of-nrf52810/290126#290126"]but you can find the cleaned up version here[/quote]
&lt;p&gt;Thank you very much.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/70113/issues-in-reading-analog-mic-data-over-saadc-pin-of-nrf52810/290126#290126"]Is this not the frequency you need?[/quote]
&lt;p&gt;Yes, still need to sample at 8KHz but that&amp;#39;s not the only sample rate I need to work on.&amp;nbsp;Will&amp;nbsp;go as low as 1KHz or even 500Hz as well.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/70113/issues-in-reading-analog-mic-data-over-saadc-pin-of-nrf52810/290126#290126"] but if you are running the ADC already the difference is unlikely to be that large (unless you want to sample the ADC at a slow rate, then an RTC or the app_timer module is preferred).&amp;nbsp;[/quote]
&lt;p&gt;I see. But I really need to lower current consumption while sampling at the same rate (8KHz) and lower. So I was thinking of using Low power timer (RTC) for ADC. In case I want to confirm how much difference do I get with TIMER vs. RTC (since I do intend to also lower the sample rate as mentioned above), can I use RTC1 (already used by app_timer) by modifying the app_timer.c by, for example, adding a function to it which set&amp;#39;s the CC1 register (CC0 used already by app timer) and ties the COMPARE1 register to PPI ? Or any other way you suggest I can use the RTC1 timer to not interrupt the app timer routines in my application and at the same time be able to use it for sampling via PPI ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/290126?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2021 07:47:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d6375be-aa39-420b-b4bd-30cd60ba13f4</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Manish&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="Manish Kaul"]I had a quick glance at the code and was curious as to why have you enabled the&amp;nbsp;LFCLK [/quote]
&lt;p&gt;This was a remnant from the original example I based it on. After I shared the example with you I cleaned it up a bit, and asked my colleague to include it in his repository.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It seems he hasn&amp;#39;t included it there yet, but you can find the cleaned up version here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrfx_5F00_saadc_5F00_continuous_5F00_sampling_5F00_v2.zip"&gt;devzone.nordicsemi.com/.../nrfx_5F00_saadc_5F00_continuous_5F00_sampling_5F00_v2.zip&lt;/a&gt;&lt;/p&gt;
[quote user="Manish Kaul"]Can you please explain me how I can use a separate RTC module to trigger ADC sample (using PPI only) given that nRF52810 has only RTC0(used by softdevice) and RTC1(used by app_timer) ?[/quote]
&lt;p&gt;There is no need to use a separate timer if you want to sample at 8kHz, then you can use the SAMPLERATE register as the example shows. Is this not the frequency you need?&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t have any RTC&amp;#39;s available you can also use a TIMER module to trigger ADC sampling. Generally the&amp;nbsp;TIMER modules use more current than RTC&amp;#39;s (while offering better accuracy), but if you are running the ADC already the difference is unlikely to be that large (unless you want to sample the ADC at a slow rate, then an RTC or the app_timer module is preferred).&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/289978?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2021 11:12:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2554cf20-618f-42c5-a6f3-1dfef2a3afe8</guid><dc:creator>Manish Kaul</dc:creator><description>&lt;p&gt;Thanks overbekk, for the example. I had a quick glance at the code and was curious as to why have you enabled the&amp;nbsp;LFCLK ? Wouldn&amp;#39;t the internal ADC timer use the HFCLK(16MHz) ?&lt;br /&gt;Also,&amp;nbsp;&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/70113/issues-in-reading-analog-mic-data-over-saadc-pin-of-nrf52810/287651#287651"]For triggering ADC samples it is recommended to use a separate TIMER or RTC module[/quote]
&lt;p&gt;Can you please explain me how I can use a separate RTC module to trigger ADC sample (using PPI only) given that nRF52810 has only RTC0(used by softdevice) and RTC1(used by app_timer) ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/289784?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 14:14:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f96cf94c-2d76-4716-91fe-b26bb86fd79d</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Manish&lt;/p&gt;
&lt;p&gt;You will find the example attached:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrfx_5F00_saadc_5F00_continuous_5F00_sampling.zip"&gt;devzone.nordicsemi.com/.../nrfx_5F00_saadc_5F00_continuous_5F00_sampling.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It is&amp;nbsp;based on a set of &lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples"&gt;ADC examples&lt;/a&gt; made by one of my colleagues, but adjusted to use the SAMPLERATE feature.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/289075?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 08:02:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1087a785-ce92-488b-a629-8ca700a5cb12</guid><dc:creator>Manish Kaul</dc:creator><description>&lt;p&gt;Hey,&lt;/p&gt;
&lt;p&gt;Sure and please do share your entire code with me . Thanks !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/289074?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 08:00:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:687c67e0-5343-4443-9419-92712bdad226</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Manish&lt;/p&gt;
&lt;p&gt;I will try to set up a small example to get this working, and see if I run into similar issues. I will get back to you as soon as I have some results to share.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/288854?ContentTypeID=1</link><pubDate>Wed, 13 Jan 2021 09:34:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eced056d-31ac-4ab3-afd5-d235e2629f94</guid><dc:creator>Manish Kaul</dc:creator><description>&lt;p&gt;Yes I configure the ADC buffer using &amp;#39;nrf_drv_saadc_buffer_convert()&amp;#39; and right after that trigger the start task (&lt;span&gt;NRF_SAADC_TASK_START).&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/288849?ContentTypeID=1</link><pubDate>Wed, 13 Jan 2021 09:27:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fae3876c-a535-4765-865f-a42a3807832a</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t see any reason why those channel settings should prevent the continuous sampling from working.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you make sure to configure the ADC buffers before you trigger the start task?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/288576?ContentTypeID=1</link><pubDate>Tue, 12 Jan 2021 09:52:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9e75c69-f3b2-4e99-bc65-7c47dcf4b0e2</guid><dc:creator>Manish Kaul</dc:creator><description>&lt;p&gt;Hey&lt;/p&gt;
&lt;p&gt;Yes , the API takes care of that.&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1610444764836v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;I pass 2000 as cc upon calling the function during initialization. The following is the code for initialization function:&lt;pre class="ui-code" data-mode="c_cpp"&gt;bool SDL_Mic_Init(void)
{
  uint32_t ret_code=false;
  
  
  ret_code=nrf_drv_saadc_init(NULL, mic_callback);  //ADC Initialization
  
  if(ret_code==NRFX_SUCCESS)
  { 
    nrf_saadc_channel_config_t adc_channel=NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(MIC_INPUT_DATA_PIN);
    
    ret_code=nrf_drv_saadc_channel_init(MIC_ADC_CHANNEL,&amp;amp;adc_channel);
    if(ret_code==NRFX_SUCCESS)
      ret_code=true;
    
    nrf_saadc_continuous_mode_enable(2000); //for 8K sample rate (16000000/2000=8000Hz)
  }
  
  return ret_code;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Could there be anything wrong with the adc channel initialization in the above posted code snippet, which as you can see I have used as default ?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P) \
{                                                   \
    .resistor_p = NRF_SAADC_RESISTOR_DISABLED,      \
    .resistor_n = NRF_SAADC_RESISTOR_DISABLED,      \
    .gain       = NRF_SAADC_GAIN1_6,                \
    .reference  = NRF_SAADC_REFERENCE_INTERNAL,     \
    .acq_time   = NRF_SAADC_ACQTIME_10US,           \
    .mode       = NRF_SAADC_MODE_SINGLE_ENDED,      \
    .burst      = NRF_SAADC_BURST_DISABLED,         \
    .pin_p      = (nrf_saadc_input_t)(PIN_P),       \
    .pin_n      = NRF_SAADC_INPUT_DISABLED          \
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/288527?ContentTypeID=1</link><pubDate>Tue, 12 Jan 2021 07:30:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e457f563-b9af-4c07-9701-cbd7df453032</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Did you make sure to set bit 12 in the SAMPLERATE register to enable the local timer?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/288317?ContentTypeID=1</link><pubDate>Mon, 11 Jan 2021 09:13:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f10d2349-af22-45df-b9ac-dbcb48a8003b</guid><dc:creator>Manish Kaul</dc:creator><description>&lt;p&gt;Okay I&amp;#39;ll try to do that and take a look at the example as well. But I still don&amp;#39;t understand one thing, why do I need to use timer when I want to do continuous sampling. Why can&amp;#39;t I just set the sample rate in the register as 8KHz (16Mhz/2000) and trigger ADC_START_TASK (NRF_SAADC_TASK_START)&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1610356355471v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;As I understand (and also from the comment documentation) , it should convert samples at the specified sample rate till RAM buffer is full and once the RAM buffer is full I should&amp;nbsp;receive&amp;nbsp;NRFX_SAADC_EVT_DONE event and upon this event I just transmit the buffer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I try to do that, it just converts one sample and stops. Can you please explain that ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues in reading analog mic data over SAADC pin of nRF52810.</title><link>https://devzone.nordicsemi.com/thread/287651?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2021 09:11:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12d9fcbb-68a3-48ee-a6f5-8078d30477b7</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The problem is that&amp;nbsp;callback configured through the app_timer will be affected by other interrupts and latencies in the system, and is not suited for scheduling very rapid events.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The app_timer is normally only used for event that happen at a slower rate, and where you can accept some delays in the execution.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For triggering ADC samples it is recommended to use a separate TIMER or RTC module, and have it trigger the ADC in the background using the PPI module. Then you don&amp;#39;t have to run any code to trigger ADC sampling, and it will not be affected by other interrupts in the system.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For an example of how to implement this please have a look at the saadc example in the SDK:&lt;br /&gt;&lt;em&gt;\nRF5_SDK_17.0.2_d674dde\examples\peripheral\saadc&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>