<?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 calibration on nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59827/saadc-calibration-on-nrf52840</link><description>Hi, 
 I am using the SAADC (AIN2) to get temperature values from a Pt1000, and I am experiencing sometimes strange behaviour after the offset calibration is done.I have quite simple requirements (only one analog value, repeat sampling every 2 ms until</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Feb 2025 16:43:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59827/saadc-calibration-on-nrf52840" /><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/522509?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2025 16:43:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e791cd32-5bc7-40ae-a8e6-70bf55331578</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Pity, but yes you can still improve the readings. A lot depends on the board layout, and whether the unused AIN pins are attached to anything. I would start by taking 2 adjacent spare analogue inputs and enabling both high and low 160k internal bias resistors then take a differential reading with the two inputs in 1-pin_p 2-pin_n format then reverse and take a reading in 1-pin_n and 2-pin_p. The difference gives the 2 x the residual SAADC offset. The gain settings and reference need to be the same as used for the real data sampling. Take lots of readings, or use OVERSAMPLE.&lt;/p&gt;
&lt;p&gt;Perhaps try repeating with internal both VDD/4 and internal both GND to see how they compare, again reversing p and n to get balanced values. I would expect the best results from using the mid rail bias however.&lt;/p&gt;
&lt;p&gt;If there is only a single spare input pin this is not an option. Maybe share the front-end schematic and input voltage ranges in case I see another option.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/522489?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2025 15:06:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f6a25fb-146a-4cb3-a108-1584fb0363b2</guid><dc:creator>Rafael Ramos</dc:creator><description>&lt;p&gt;Thanks for the quick reply.&lt;/p&gt;
&lt;p&gt;The hardware in this case is already in the field in large numbers and we want to tune things to get extra quality out of the current setup, so I can&amp;#39;t add resistors or tie pins externally to GND, etc.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I do have unused analog inputs so we can dedicate one to a calibration but can we tie it internally to gnd with firmware ? is there another idea you can suggest?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The input is a 0-5v sensor over a relatively long cable that is filtered and conditioned down to 3v on board and then fed to the NRF52840.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/522336?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2025 05:33:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6c1da32-c702-4a5b-bfdb-0518b258634c</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Calibration always results in a discontinuous jump in the baseline, and although calibration is worth doing initially is not very effective following the initial calibration. Far better to use a true differential measurement, even if one end of the measurement is effectively GND, and simply reverse the inputs for successive readings and take the average. Such a reversal is trivial and is performed in software, not hardware; 2 analogue inputs are required, even if one end is at GND; a single input will not allow residual offset correction, I posted a schematic (circuit diagram) and low-level (bare-metal) code showing how to do this for an RTD resistance measurement, getting near 12-bits ENOB which is pretty amazing for a general-purpose MPU&amp;nbsp; internal ADC. Temperature tracking is automatic and smooth provided SAADC, reference resistor and sense resistor are all in close proximity..&lt;/p&gt;
&lt;p&gt;Measured 14-bit value of 905.0 Ohm 2-Wire test resistor using 128 samples is 904.9 Ohms with -0.01% error&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Internal 0.6v Ref 14-bit S0S1 2-Wire RTD actual value 905.0 Ohm (reference 2001.4 Ohm) - Pos-Neg ADC
// VDD mV Iref uA  RdsOn  V1 mV V2 mV V3 mV    Vrtd    Vref   Rrtd  Error
// ====== ======= ======  ===== ===== =====  ======  ====== ====== ======
//   2974    1008     41   2932   911    -3  3108.5  6883.3  903.8 -0.13%
//   2975    1007     41   2933   912    -2  3108.3  6882.6  903.8 -0.13%
//   2974    1007     37   2936   913    -2  3107.9  6882.4  903.8 -0.14%
//   2976    1007     42   2933   914    -2  3108.5  6882.0  904.0 -0.11%
//   2973    1007     38   2934   911    -2  3108.3  6881.3  904.0 -0.11%
//   2977    1007     42   2934   911    -1  3110.3  6882.9  904.4 -0.07%
//   2978    1008     40   2937   913    -1  3110.1  6884.8  904.1 -0.10%
//   2977    1008     40   2936   913    -1  3109.8  6885.3  903.9 -0.12%
//
// Internal 0.6v Ref 14-bit S0S1 2-Wire RTD actual value 905.0 Ohm (reference 2001.4 Ohm) - Neg-Pos ADC
// VDD mV Iref uA  RdsOn  V1 mV V2 mV V3 mV    Vrtd    Vref   Rrtd  Error
// ====== ======= ======  ===== ===== =====  ======  ====== ====== ======
//   2977    1010     41   2935   912    -3  3120.1  6896.4  905.5  0.05%
//   2976    1009     40   2935   912    -2  3119.5  6893.8  905.7  0.07%
//   2973    1009     39   2933   912    -2  3119.4  6892.3  905.8  0.09%
//   2976    1010     40   2935   911     0  3121.9  6896.3  906.0  0.11%
//   2975    1010     39   2935   913    -2  3120.9  6896.3  905.7  0.08%
//   2975    1009     40   2934   911    -1  3120.0  6891.4  906.1  0.12%
//   2976    1009     41   2934   912     0  3118.6  6892.3  905.6  0.07%
//   2975    1009     38   2936   913    -1  3118.3  6891.4  905.6  0.07%
//
// Measured 14-bit value of 905.0 Ohm 2-Wire test resistor using 128 samples is 904.9 Ohms with -0.01% error
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/116914/seeking-more-information-on-nrf52833-adc-reference-and-buffers/517786"&gt;seeking-more-information-on-nrf52833-adc-reference&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/522333?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2025 04:46:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6fb88c3-01c4-454a-9e42-5e19f5d74c4d</guid><dc:creator>Rafael Ramos</dc:creator><description>&lt;p&gt;I have a very similar issue, but this suggestion is confusing, Should I configure both the negative and postive of the same channel to the same input at the same time ? (VDD)&lt;/p&gt;
&lt;p&gt;I am assuming I would need to configure it to be differential?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What reference should I use at this point ? The internal one ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am not sure this makes sense to me, but I tried it and only got zero for the reading (as I would expect, but not what this post suggests)&lt;/p&gt;
&lt;p&gt;This is the actual config code :&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;nrf_saadc_channel_config_t&lt;/span&gt;&lt;span&gt; channel_config &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .resistor_p &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_RESISTOR_DISABLED&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .resistor_n &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_RESISTOR_DISABLED&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .gain &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_GAIN1_4&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .reference &amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_REFERENCE_INTERNAL&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .acq_time &amp;nbsp; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_ACQTIME_40US&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .mode &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_MODE_DIFFERENTIAL&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .burst &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_BURST_ENABLED&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .pin_p &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_INPUT_VDD&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .pin_n &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; NRF_SAADC_INPUT_VDD&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I have tried super sampling and a filtering but the temperature effects can&amp;#39;t really be accounted for , and every time the calibration runs, the values jump to a new baseline, so that ruins long term calculations.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I would appreciate some help in this regard.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Thanks !&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/243843?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 09:20:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bee50e78-d743-4428-b7f5-79b6839882be</guid><dc:creator>haakonsh</dc:creator><description>[quote user="harti"]Where can I find a functional description?[/quote]
&lt;p&gt;I&amp;#39;m sorry but that&amp;#39;s proprietary information.&amp;nbsp;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
[quote user="harti"]How big is the jump that occurs after a calibration?[/quote]
&lt;p&gt;&amp;nbsp;The calibration DAC is around +-2 LSB10b (+-8 LSB12b)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/243839?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 09:16:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88b85d92-9ab8-46a0-8067-fb8f766ae002</guid><dc:creator>haakonsh</dc:creator><description>[quote user="dzabel"]I should completely avoid the the built-in calibration and instead do a digital offset calculation as described in step 1-3?[/quote]
&lt;p&gt;&amp;nbsp;&amp;nbsp;Yes, I recommend it for your application.&amp;nbsp;&lt;/p&gt;
[quote user="dzabel"]what is happening exactly if I use the built-in calibration and how I can observe the calculated offset.[/quote]
&lt;p&gt;&amp;nbsp;The built-in calibration uses an analog reference to compensate for the offset, but this reference is&amp;nbsp;susceptible to thermal noise that will give a slightly different offset each time.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/243823?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 08:41:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5fd5087-cb51-426c-8df5-a714e98e4343</guid><dc:creator>dzabel</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thank you for the reply. I was using HFXO already. I have activated oversampling as suggested, and it does reduce the noise a bit. But it does not influence the strange calibration behaviour, i.e. sudden unexpected shifts of the values after calibration task has been executed. I have tried to increase the calibration rate by doing it time-dependent instead of temperature-dependent, but that only seems to increase the rate of value shifts. So do I understand you right I should completely avoid the the built-in calibration and instead do a digital offset calculation as described in step 1-3? My question would be still what is happening exactly if I use the built-in calibration and how I can observe the calculated offset.&lt;/p&gt;
&lt;p&gt;Regards Dirk&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/243822?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 08:36:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdb010f9-6753-4cb4-a48c-7ebb32c1261e</guid><dc:creator>harti</dc:creator><description>&lt;p&gt;&lt;span class="tlid-translation translation"&gt;&lt;span class="" title=""&gt;I find neither an indication of the temperature drift of the internal reference nor a description of how the calibration works.&lt;/span&gt;&lt;br /&gt;&lt;span title=""&gt;Where can I find a functional description?&lt;/span&gt;&lt;br /&gt;&lt;span class="" title=""&gt;How big is the jump that occurs after a calibration?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC calibration on nRF52840</title><link>https://devzone.nordicsemi.com/thread/243405?ContentTypeID=1</link><pubDate>Fri, 03 Apr 2020 12:45:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47759e92-c5c5-4e7f-b68b-59d1c278824f</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;The analog reference used in the automatic offset calibration is a bit temperature-sensitive and not really suited in designs with high accuracy requirements.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;What you can do is a digital offset calibration:&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Connect positive and negative inputs to the same signal, f.ex VDD/4.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Take a sample.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Subtract the sample value from all future samples (until you calibrate again).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This will reduce the offset further and have less variation in offsets between calibrations, but it will require a float or integer operation extra.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I also strongly recommend that you enable oversampling, at least 4-8X as there can be a fair bit of transient noise in the power supply for the thermistor.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;You can also turn on the HFXO for a further increase in accuracy.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>