<?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>SAADC measurement doesn`t occur after SAADC offset calibration.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96743/saadc-measurement-doesn-t-occur-after-saadc-offset-calibration</link><description>Hello. I have a problem when using nrfx_saadc. I try to start the sampling right after the SAADC offset calibration, but it doesn&amp;#39;t happen and the program hangs. Only if I add a delay(4ms) before the measurement, then everything works as it should. I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 17 Feb 2023 07:52:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96743/saadc-measurement-doesn-t-occur-after-saadc-offset-calibration" /><item><title>RE: SAADC measurement doesn`t occur after SAADC offset calibration.</title><link>https://devzone.nordicsemi.com/thread/410522?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2023 07:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6919ee30-f33a-428b-b0a7-b499cf7c8abe</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="vitaliy2034"]1. Sorry, I didn&amp;#39;t express myself correctly. I meant that the SAADC measurement does not occur after calibration.[/quote]
&lt;p&gt;No need to apologize - I will just ask if there&amp;#39;s anything unclear. Thank you for clarifying.&lt;/p&gt;
[quote user="vitaliy2034"]2. Of course, I have selected the Debug configuration, and configured the nrfx_saadc driver to display 4th-level logs (Debug). But there was nothing interesting except that the event NRF_SAADC_EVENT_END is fired.[/quote]
&lt;p&gt;You must still add the DEBUG define to your preprocessor defines, like shown in the picture, if you would like to have the logger output the detailed error message. This is not defined in the debug configuration by default.&lt;/p&gt;
[quote user="vitaliy2034"]3. Yes, you understand the problem correctly. It looks like the anomaly that was attached. Thanks.[/quote]
&lt;p&gt;Great, I am glad to hear that we got this one figured out.&lt;br /&gt;Does it return to the expected behavior when you apply the workaround as described in the Errata?&lt;/p&gt;
[quote user="vitaliy2034"]4. I do SAADC calibration every 20,000 measurements (1 measurement in 50ms). So I understand that this is not very optimal. Could you advise me on how to do it correctly without writing a ton of code?&amp;nbsp;[/quote]
&lt;p&gt;As I mentioned we recommend performing a calibration on boot, and then once more every time the ambient temperature of the environment that the nRF is working in changes by 10 degrees celsius.&lt;br /&gt;You should not have to perform calibrations for every 20,000 measurement, but you can of course do this if you&amp;#39;d like - there&amp;#39;s no harm done.&lt;br /&gt;If you know that the ambient temperature is prone to change, and you do not have any temperature sensor on your board, then you may perform the calibration periodically instead (like you are doing now) to keep the SAADC measurements accurate.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC measurement doesn`t occur after SAADC offset calibration.</title><link>https://devzone.nordicsemi.com/thread/410336?ContentTypeID=1</link><pubDate>Thu, 16 Feb 2023 12:25:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2d1d294-0670-4bca-bf84-d73fc1ac7941</guid><dc:creator>vitaliy2034</dc:creator><description>&lt;p&gt;1. Sorry, I didn&amp;#39;t express myself correctly. I meant that the SAADC measurement does not occur after calibration.&lt;br /&gt;&lt;br /&gt;2. Of course, I have selected the Debug configuration, and configured the nrfx_saadc driver to display 4th-level logs (Debug). But there was nothing interesting except that the event NRF_SAADC_EVENT_END is fired.&lt;/p&gt;
&lt;p&gt;Just in case, here are the SAADC logs:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; SAADC: Channel initialized: 0.
&amp;lt;info&amp;gt; SAADC: Function: nrfx_saadc_channel_init, error code: NRF_SUCCESS.
&amp;lt;info&amp;gt; SAADC: Function: nrfx_saadc_calibrate_offset, error code: NRF_SUCCESS.
&amp;lt;debug&amp;gt; SAADC: Event: NRF_SAADC_EVENT_CALIBRATEDONE.
&amp;lt;info&amp;gt; SAADC: Function: nrfx_saadc_buffer_convert, buffer length: 1, active channels: 1.
&amp;lt;info&amp;gt; SAADC: Function: nrfx_saadc_buffer_convert, error code: NRF_SUCCESS.
&amp;lt;info&amp;gt; SAADC: Function: nrfx_saadc_sample, error code: NRF_SUCCESS.
&amp;lt;debug&amp;gt; SAADC: Event: NRF_SAADC_EVENT_END.
&amp;lt;debug&amp;gt; SAADC: Event: NRF_SAADC_EVENT_STARTED.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;3. Yes, you understand the problem correctly. It looks like the anomaly that was attached. Thanks.&lt;/p&gt;
&lt;p&gt;4. I do SAADC calibration every 20,000 measurements (1 measurement in 50ms). So I understand that this is not very optimal. Could you advise me on how to do it correctly without writing a ton of code?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC measurement doesn`t occur after SAADC offset calibration.</title><link>https://devzone.nordicsemi.com/thread/410243?ContentTypeID=1</link><pubDate>Thu, 16 Feb 2023 08:32:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bcf98cc-ea64-4af8-b8aa-55839521b518</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]I try to start the sampling right after the SAADC offset calibration, but it doesn&amp;#39;t happen and the program hangs.[/quote]
&lt;p&gt;What happens when the program &amp;#39;hangs&amp;#39;?&lt;br /&gt;Do you have logs from when this happens, or have you tried to use the debugging option to see where the program counter stops (if it does)?&lt;br /&gt;&lt;br /&gt;I also recommend that you make sure to have DEBUG defined in your preprocessor defines, like shown in the included image:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/46660.enabling_5F00_debug_5F00_SES.PNG" /&gt;&lt;br /&gt;This will make your logger output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK.&lt;/p&gt;
[quote user=""]I also noticed that if I do not add this delay before nrfx_saadc_sample() function calling, SAADC generate EVENT_END event.[/quote]
&lt;p&gt;I am not sure I fully understand this description, could you elaborate?&lt;br /&gt;If you do not add the delay then you will get an unexpected END event, is that so?&lt;br /&gt;This sounds like it might be due to &lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev3/ERR/nRF52832/Rev3/latest/anomaly_832_178.html"&gt;the Errata-178&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;How often are you performing the offset calibration? Do you do so before every sample?&lt;br /&gt;In general we recommend that you perform a calibrateoffset at the boot, and then once more every time the ambient changes with 10 Celsius, for best results.&lt;/p&gt;
[quote user=""]SAADC Configuration:[/quote]
&lt;p&gt;Just for context, could you elaborate on what you are sampling as well?&lt;br /&gt;For instance, what sampling frequency are you using?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>