<?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>NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100043/nrf52810-adc-calibration-with-burst-oversampling-issue</link><description>Hi, I&amp;#39;ve previously used ADC calibration without problem but then I&amp;#39;ve began using the burst oversampling. Now, after calibration all reads return what appears to be random data and then usually zero reads. There are a couple errata points though the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 May 2023 14:12:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100043/nrf52810-adc-calibration-with-burst-oversampling-issue" /><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/428207?ContentTypeID=1</link><pubDate>Tue, 30 May 2023 14:12:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a5e052f-51a4-45ba-a14f-0df3b311f9b0</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;I can recommend the saadcv2 driver in nRF5_SDK_17.x&lt;/p&gt;
[quote user="snoopy20"]FYI I also found that running calibration will execute a compare LIMITL/H against the calibration value (0, -1 etc).[/quote]
&lt;p&gt;Can you share some more information? I don&amp;#39;t fully understand what you mean. Are you getting&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/saadc.html?cp=5_5_0_5_16_10_10#register.EVENTS_CH-0-7.LIMITH"&gt;EVENTS_CH[n].LIMITH&lt;/a&gt;&amp;nbsp;after triggering the calibration task?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427943?ContentTypeID=1</link><pubDate>Sun, 28 May 2023 21:46:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa9e14da-5d8b-4860-beae-45800e208852</guid><dc:creator>snoopy20</dc:creator><description>&lt;p&gt;I&amp;#39;ve given up with it.&lt;br /&gt;&lt;br /&gt;FYI I also found that running calibration will execute a compare LIMITL/H against the calibration value (0, -1 etc).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427864?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 15:03:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20a00b74-36ee-42d8-a639-6d1c9b0964b4</guid><dc:creator>haakonsh</dc:creator><description>[quote user="snoopy20"]My position is once a burst with oversample is used then calibration is no longer possible.[/quote]
&lt;p&gt;What happens if you set burst and oversample to 0 before calibrating?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;What happens if you trigger START, wait for STARTED event, trigger STOP, wait for STOPPED event, before calibrating?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427599?ContentTypeID=1</link><pubDate>Thu, 25 May 2023 16:28:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:590a7a48-b367-4f41-bc61-75814366154c</guid><dc:creator>snoopy20</dc:creator><description>&lt;p&gt;I don&amp;#39;t, both those erratas are the same thing - that calibration shouldn&amp;#39;t be&amp;nbsp;executed&amp;nbsp;inbetween a start and end. To answer your questions:&lt;br /&gt;&lt;br /&gt;1 = nothing&lt;br /&gt;2 = nothing&lt;br /&gt;3 = yes, by a safe margin&lt;br /&gt;&lt;br /&gt;I calculated the timings and added a margin to ensure the scheduler doesn&amp;#39;t race against the end. These are working fine - you can see them in the code in the first post (the return from a task is how long the scheduler has to wait before the next task is executed).&lt;br /&gt;&lt;br /&gt; Bare in mind the scheduler works on a 500ms loop. There&amp;#39;s no means to make the ADC oversample with burst anywhere near that, i.e 256x8x(40us+2us)...&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve also added a wait for event_end as a test, although easydma can still be copying at that point. It makes no difference anyhow.&lt;br /&gt;&lt;br /&gt;My position is once a burst with oversample is used then calibration is no longer possible.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427596?ContentTypeID=1</link><pubDate>Thu, 25 May 2023 16:10:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:287b467a-1cdc-4f96-b800-bc9a61649c68</guid><dc:creator>haakonsh</dc:creator><description>[quote user="snoopy20"]At this stage I think it&amp;#39;s a hardware bug, as soon as burst/oversample is used after calibration the process fails.[/quote]
&lt;p&gt;I agree, but I believe it is the same issue as&amp;nbsp;the erratas I listed earlier.&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;What happens if you do clear the END event before triggering the SAMPLE task, and verify that the END event has fired before you trigger the&amp;nbsp;CALIB*&amp;nbsp;task?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;What happens if you clear the DONE, END, and CALIBRATEDONE events before triggering the CALIB* task?&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;I see now that RESULT.AMOUNT is only valid after an END or STOPPED event. Do you expect to have transferred 6 samples the previous time the SAMPLE task was triggered?&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427567?ContentTypeID=1</link><pubDate>Thu, 25 May 2023 14:29:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26f9b080-db2f-421e-8e5f-314c7ad2f6e3</guid><dc:creator>snoopy20</dc:creator><description>&lt;p&gt;Think I&amp;#39;m going to give up on this one.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best I can manage is to calibrate once on boot prior to burst/sampling being used. It&amp;#39;s better than nothing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427535?ContentTypeID=1</link><pubDate>Thu, 25 May 2023 13:17:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc87446b-9f47-4f67-a605-d2d7483431c8</guid><dc:creator>snoopy20</dc:creator><description>&lt;p&gt;1. I guarantee the END has either fired because the ADC has complete or hasn&amp;#39;t fired because START hasn&amp;#39;t been called by design, there&amp;#39;s no need to check it. Reason for this is the call to ADC calibrate occurs every 500ms. There is now 500ms to get through the remaining tasks and most return 0 so have ns overhead. Only the singles and powers sample tasks return values in the ms to cater for sampling delay. The powers task having the much larger oversample I calculate it to be 11ms*8ch &amp;lt; 100ms, way way less than the allocated 500ms. This is also why it all works perfectly (until calibration is called).&lt;br /&gt;&lt;br /&gt;2. Here is how it sits before calibration on n&amp;gt;1 attempt&lt;br /&gt;&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/Screenshot_5F00_2023_2D00_05_2D00_25_5F00_14_2D00_05_2D00_47.png" /&gt;&lt;br /&gt;&lt;br /&gt;&amp;quot;&lt;span&gt;Can you read&amp;nbsp;&lt;/span&gt;&lt;a title="RESULT.AMOUNT" href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/saadc.html?cp=5_5_0_5_16_10_26#register.RESULT.AMOUNT"&gt;RESULT.AMOUNT&lt;/a&gt;&lt;span&gt;&amp;nbsp;after calibration and START task, but before the SAMPLE task? &amp;quot;&lt;br /&gt;&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/Screenshot_5F00_2023_2D00_05_2D00_25_5F00_14_2D00_15_2D00_49.png" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. The same, all channels read incorrectly.&lt;br /&gt;&lt;br /&gt;The only thing I have assumed is the time required for the calibration to complete, but I offered it 100ms and it was still the same, and I can&amp;#39;t see it taking longer than this, unless someone knows otherwise.&lt;br /&gt;&lt;br /&gt;At this stage I think it&amp;#39;s a hardware bug, as soon as burst/oversample is used after calibration the process fails.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427491?ContentTypeID=1</link><pubDate>Thu, 25 May 2023 11:07:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb4accd2-f0c4-4110-aba8-edd3d6632d57</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Can you check for the END event before starting the calibration task? You will need to make sure that the END event as been cleared before triggering any START task.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="snoopy20"]Nothing in the manual suggests&amp;nbsp;ADC_TaskCalibrate has anything to do with the enabled channels, or oversampling though. [/quote]
&lt;p&gt;No, not really. But the underlying issue is that the SAADC&amp;#39;s DMA master and related state machines are active during offset calibration, unless the workaround is implemented (before the START task and after the END event this circuitry is disabled). The DMA master stores the calibration samples into RAM as if a regular sampling sequence has begun.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you read&amp;nbsp;&lt;a title="RESULT.AMOUNT" href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/saadc.html?cp=5_5_0_5_16_10_26#register.RESULT.AMOUNT"&gt;RESULT.AMOUNT&lt;/a&gt;&amp;nbsp;after calibration and START task, but before the SAMPLE task?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="snoopy20"] I wonder though, is this calibration just making all channels enabled to ground then taking a read which is used as an offset?[/quote]
&lt;p&gt;The offset calibration is&amp;nbsp;common for all channels. The positive and negative input into the resistor ladder and gain stage is internally connected to GND, where some trim values are adjusted until the sampled offset equal zero (ADC code 0x00).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure whether a channel is used at all for this procedure, if it is then it will either be channel 0 or 7.&amp;nbsp;&lt;/p&gt;
[quote user="snoopy20"]FYI the sample value from&amp;nbsp;ADC_TaskSampleStorage alternates between 0-2 after taskcalibrate has been called.[/quote]
&lt;p&gt;What happens to this alternating sample value if you switch channel from 0 to 1? &lt;br /&gt;I.e. ADC_CH_SINGLES_STORE to ADC_CH_SINGLES_LIGHT_SENSE, but with the same pin config as before.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427332?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 20:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4081c75-ee12-4c3e-8b4c-0154eba4f71a</guid><dc:creator>snoopy20</dc:creator><description>&lt;p&gt;&lt;span&gt;ADC_TaskSampleStorage = 1&lt;br /&gt;&lt;br /&gt;I can confirm setting oversample=0 doesn&amp;#39;t work.&lt;br /&gt;&lt;br /&gt;FYI the sample value from&amp;nbsp;ADC_TaskSampleStorage alternates between 0-2 after taskcalibrate has been called.&lt;br /&gt;&lt;br /&gt;ADC_TaskSampleStorage only gets called once on startup, hence it&amp;#39;s not wiping the other 7 channels. After that it&amp;#39;s combined into&amp;nbsp;ADC_TaskSampleSingles.&lt;br /&gt;&lt;br /&gt;Nothing in the manual suggests&amp;nbsp;ADC_TaskCalibrate has anything to do with the enabled channels, or oversampling though. I wonder though, is this calibration just making all channels enabled to ground then taking a read which is used as an offset?&lt;br /&gt;&lt;br /&gt;Rgs,&lt;br /&gt;&lt;br /&gt;Andrew&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427307?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 16:09:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5ad3a24-9be7-4191-868c-7b4dc4cf261d</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;How many channels are enabled when you call&amp;nbsp;ADC_TaskSampleStorage and ADC_TaskCalibrate? Can you read CH[x].PSEL for each channel from memory?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you set OVERSAMPLE to 0x00 before starting calibration?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427033?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 18:30:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03993c78-8e36-4d38-b3a9-f61510576e09</guid><dc:creator>snoopy20</dc:creator><description>&lt;p&gt;I don&amp;#39;t understand the innards of calibration but assume it doesn&amp;#39;t need oversample or any channel config? I also assume when the ADC is disabled the calibration is lost.&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t use events_calibrateddone because it&amp;#39;s sync and I need low latency from the CPU for other operations.&lt;br /&gt;&lt;br /&gt;As for [237] you can see I&amp;#39;ve covered this on lines 44+45 and 25+26+27&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t run calibration during sampling, the tasks are sequenced so [252] can&amp;#39;t apply.&lt;br /&gt;&lt;br /&gt;It&amp;#39;s something to do with burst/oversampling mode. With that disabled calibration works.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;&lt;br /&gt;Andrew&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52810 ADC Calibration With Burst Oversampling Issue</title><link>https://devzone.nordicsemi.com/thread/427026?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 17:11:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b74f3d4-f6be-410f-8eaa-3469957bb634</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;You might hit&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52810_Rev3/ERR/nRF52810/Rev3/latest/anomaly_810_252.html?cp=5_5_1_0_1_28"&gt;[252] SAADC: Unexpected behavior when TASKS_CALIBRATEOFFSET is used during sampling&lt;/a&gt;&amp;nbsp;or&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52810_Rev3/ERR/nRF52810/Rev3/latest/anomaly_810_237.html?cp=5_5_1_0_1_24"&gt;[237] SAADC: TASKS_CALIBRATEOFFSET shall only be used before TASKS_START or after EVENTS_END&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
[quote user=""]I&amp;#39;ve used up to 200ms for calibration and I can&amp;#39;t see it taking any more than this, though I couldn&amp;#39;t find the typical timing data for it either.[/quote]
&lt;p&gt;I&amp;#39;d&amp;nbsp;expect the offset calibration&lt;span&gt;&amp;nbsp;&lt;/span&gt;to take similar time to a regular sample multiplied by&amp;nbsp;&lt;a title="OVERSAMPLE" href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/saadc.html?cp=5_5_0_5_16_10_22#register.OVERSAMPLE"&gt;OVERSAMPLE&lt;/a&gt;, pluss a tiny bit to adjust some trim values. Why don&amp;#39;t you use the&amp;nbsp;&lt;a title="EVENTS_CALIBRATEDONE" href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/saadc.html?cp=5_5_0_5_16_10_8#register.EVENTS_CALIBRATEDONE"&gt;EVENTS_CALIBRATEDONE&lt;/a&gt;?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can measure the execution time of the calibration by toggling a GPIOTE channel via the&amp;nbsp;&lt;a title="TASKS_CALIBRATEOFFSET" href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/saadc.html?cp=5_5_0_5_16_10_3#register.TASKS_CALIBRATEOFFSET"&gt;TASKS_CALIBRATEOFFSET&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a title="EVENTS_CALIBRATEDONE" href="https://infocenter.nordicsemi.com/topic/ps_nrf52810/saadc.html?cp=5_5_0_5_16_10_8#register.EVENTS_CALIBRATEDONE"&gt;EVENTS_CALIBRATEDONE&lt;/a&gt;&amp;nbsp;signals.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>