<?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>stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39266/stop-and-restart-saadc-to-power-saving</link><description>Hello, I&amp;#39;m using softdevice 6.0 and SDK 15. 
 In my application, I would like stop the SAADC at the disconnection and then restart SAADC at the connection to power saving. 
 To start SAADC I use this code: 
 void saadc_init(void) { ret_code_t err_code;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Nov 2018 12:48:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39266/stop-and-restart-saadc-to-power-saving" /><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/157504?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 12:48:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:976f306d-c900-45c5-a6de-5e47a9e4dd69</guid><dc:creator>mdido</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;you&amp;#39;re right. The semaphore was not volatile. Thank you for the quick support.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/157475?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 11:22:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6b21cf3-5c51-4569-a654-ee40dfd4bf08</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This&amp;nbsp;sounds like a typical thing you could see if the semaphore is not volatile. Is it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/157452?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 10:03:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:981a971b-b80a-4236-964b-3fdad6877330</guid><dc:creator>mdido</dc:creator><description>&lt;p&gt;Hello, I used a semaphore in&amp;nbsp;saadc_callback and I wait until is cleared before of saadc_unint. If Optimization level is setted &amp;quot;none&amp;quot; everything works fine, but if I set Optimization level as &amp;quot;Optimize for size&amp;quot; seems that micro does not exit from the saadc callback. Do you have any suggest?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/152478?ContentTypeID=1</link><pubDate>Thu, 11 Oct 2018 11:35:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:147fcebf-d1a2-4bd7-9bb6-afbc97028080</guid><dc:creator>mdido</dc:creator><description>&lt;p&gt;Ok, that&amp;#39;s all clear.&lt;/p&gt;
&lt;p&gt;Thank you for the support&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/152465?ContentTypeID=1</link><pubDate>Thu, 11 Oct 2018 10:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e59cef7-045f-4b7d-9916-a78f82592b21</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You are right that if you don&amp;#39;t wait for the sampling to finish before disabling you will never get any samples (in the code snippet in my previous answer you can see this by commenting out 78). This is because you uninitialize the driver before sampling has finished, so you never actually get the callback with the sample.&lt;/p&gt;
&lt;p&gt;If this is what you are seeing, then I would say you have a bug in your code, as you uninitialize the driver before you are done using it (have not yet received the sample).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/152252?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2018 15:11:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6adfac5-9a3e-48d7-a69b-8316b279fc8b</guid><dc:creator>mdido</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;thank you for the example. Yes, your example differs from my code. I see you used a semaphore in&amp;nbsp;saadc_callback and you wait until is cleared before of saadc_unint. With this change my code works fine.If you do not use the semaphore in your code, do you get the same brhaviour as my previous code?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/152230?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2018 13:34:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d4b4ea7-4bc7-4c4d-a41e-87bdabb1eb00</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That&amp;#39;s odd. It should be straight forward, as demonstrated by this example application (adapted and simplified from the SAADC example in SDK 15.0.0):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-4cf2df15acff4244beadd99c512a6ff6/main.c"&gt;devzone.nordicsemi.com/.../main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Can you compare with the example and see in what way it differs from your implementation?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/152201?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2018 11:47:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:729b3037-236b-4342-8e58-092a50511217</guid><dc:creator>mdido</dc:creator><description>&lt;p&gt;Hello,the sequence of the operation is:&lt;/p&gt;
&lt;p&gt;connection&lt;/p&gt;
&lt;p&gt;saadc_init&lt;/p&gt;
&lt;p&gt;nrf_drv_saadc_sample&lt;/p&gt;
&lt;p&gt;saadc interrupt handler is triggered&lt;/p&gt;
&lt;p&gt;disconnection&lt;/p&gt;
&lt;p&gt;nrf_drv_saadc_uninit&lt;/p&gt;
&lt;p&gt;connection&lt;/p&gt;
&lt;p&gt;saadc_init&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;nrf_drv_saadc_sample&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;but at this point the saadc interrupt handler is not triggerd; SDK returns no error&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;Best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;"&gt;&lt;/span&gt;&lt;span style="font-size:medium;"&gt;&lt;/span&gt;&lt;span style="color:#007000;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: stop and restart SAADC to power saving</title><link>https://devzone.nordicsemi.com/thread/152187?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2018 10:45:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48d92c2f-0e61-405e-aadb-9af8c92c2210</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It is fine to call&amp;nbsp;nrf_drv_saadc_uninit() as you do, but then you also have to initialize everything again before the next use.&amp;nbsp;iI is not clear to me whether you do that or not? If not, you should get an assert from the driver if you have built the application with the DEBUG_NRF preprocessor define set (used by default in the Debug target for SES projects in the SDK).&lt;/p&gt;
&lt;p&gt;If this is not the problem, can you explain in more detail what you do and how the &amp;quot;interrupt handler of SAADC no longer works&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>