<?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>Sometimes my 12 bit ADC gives a 16 bit value</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32536/sometimes-my-12-bit-adc-gives-a-16-bit-value</link><description>I am currently working with a custom board that captures an ECG using an AD8233 chip from analog devices. Attached to the board are gold plated pads that act as electrodes that a person will touch with their fingers, which is wired to the AD8233. 
 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Mar 2018 07:30:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32536/sometimes-my-12-bit-adc-gives-a-16-bit-value" /><item><title>RE: Sometimes my 12 bit ADC gives a 16 bit value</title><link>https://devzone.nordicsemi.com/thread/125652?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 07:30:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48e7031b-4743-444b-8719-9fb23d862c22</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;You have different types of noise that affects any ADC, like non-linearity, temperature, and offset errors.&lt;/p&gt;
&lt;p&gt;I suspect it&amp;#39;s the offset error of the ADC that provides you with negative values. If you ground the ADC pin and check the result, it will yield a negative number.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The different offset/linear errors for the SAADC can be found in the el-specs:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html?cp=2_1_0_36_11#unique_397560666"&gt;http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html?cp=2_1_0_36_11#unique_397560666&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sometimes my 12 bit ADC gives a 16 bit value</title><link>https://devzone.nordicsemi.com/thread/125601?ContentTypeID=1</link><pubDate>Thu, 22 Mar 2018 17:31:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72e5b463-614a-4207-b1d2-5796bbbf49e9</guid><dc:creator>Mason</dc:creator><description>&lt;p&gt;Ok, thank you, I can start doing that.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Question for you though - why is the ADC yielding negative values? Doesn&amp;#39;t that not necessarily make sense?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sometimes my 12 bit ADC gives a 16 bit value</title><link>https://devzone.nordicsemi.com/thread/125448?ContentTypeID=1</link><pubDate>Thu, 22 Mar 2018 07:08:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ee34da9-38ae-4d5d-a763-b5e68da1f17c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the detailed graphs and raw-data. The driver will interpret the&amp;nbsp;ADC&amp;nbsp;result as a int16_t type.&lt;/p&gt;
&lt;p&gt;ex:&amp;nbsp;65533 == -3. If you store and treat the data as signed, the graphs should look better.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sometimes my 12 bit ADC gives a 16 bit value</title><link>https://devzone.nordicsemi.com/thread/125397?ContentTypeID=1</link><pubDate>Wed, 21 Mar 2018 15:46:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afabe2c4-00be-4056-ac59-af241c575f21</guid><dc:creator>Mason</dc:creator><description>&lt;p&gt;I&amp;#39;ve modified the SAADC SDK example to use four channels, sample every 6ms, and write to m_buffer_pool which is configured to have four elements (such that each channel samples once every 6ms). I don&amp;#39;t think the situations you linked describe what I&amp;#39;m seeing.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In my SAADC callback, I write the contents of two of the channels to their own dedicated array 2000 elements deep. There will be times (recently had this occur for about 1.1 seconds of samples in the middle of the sample array) There are a few bursts of less than 20 samples within this period in which there are some normal valued samples. Otherwise there is a range of values from 65523 to 65535 being returned from the callback.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I think it is also worthwhile to mention that my ADC values will normally sit at around ~400 at the lowest. Prior to seeing this 16 bit values, the ADC values will start to get lower and lower. Since I am storing my values in an unsigned 16 bit integer, perhaps these are &amp;quot;negative&amp;quot; values that are just rolling over?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is a graph of the original signal during one of these 16 bit periods:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Original Signal" src="https://devzone.nordicsemi.com/resized-image/__size/1040x580/__key/communityserver-discussions-components-files/4/originalSignal.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is that same set of values graphed, except I subtracted 65535 from every &amp;quot;16 bit&amp;quot; value such that a negative value was produced:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Corrected Signal" src="https://devzone.nordicsemi.com/resized-image/__size/1040x584/__key/communityserver-discussions-components-files/4/correctedSignal.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And just for clarity, here are the raw values captured from the ADC here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;1677
1653
1618
1588
1602
1570
1601
1578
1565
1544
1485
1450
1458
1416
1352
1338
1285
1256
1237
1177
1164
1158
1099
1071
1040
1017
1032
1013
1017
1047
979
924
878
775
734
716
687
731
728
702
744
749
747
785
697
639
610
569
592
558
473
433
340
266
311
382
456
463
308
144
5
65534
65532
65530
65532
65529
65532
65532
65529
65525
65531
65527
65527
65534
0
65529
65532
0
65530
65529
65527
65529
65533
65529
65533
65530
65527
65531
65533
65532
65527
65530
65531
65529
65527
65529
65529
65531
65529
65525
65527
65527
65528
65531
97
146
92
65527
65523
65529
65527
65533
65526
65534
65527
65532
65530
65527
65534
65527
65523
65530
65529
65530
65529
65530
65533
65531
65525
65527
65527
65525
65534
65526
65530
65527
65527
65526
0
65532
65530
65533
65530
65531
65529
65530
65527
65529
65526
65529
65527
65530
65530
65530
65532
65529
65526
65531
65532
65534
65531
65532
65530
65531
65527
65529
65529
65532
0
65533
65526
65533
65527
65527
65527
65530
65528
65526
65527
65532
65527
65533
65529
65530
0
65530
65535
65530
65527
65533
65527
65533
65527
65531
65527
65529
65529
65525
65531
65528
65529
65525
65531
65533
65527
65530
65532
65527
65529
65535
65533
65529
65532
65530
65528
65531
65526
65532
65527
65530
65535
65526
65533
65532
65533
65533
65531
65535
65533
65523
65534
65534
1
215
371
433
392
363
435
504
564
633
517
413
324
184
119
110
32
0
65525
65533
65533
65531
65531
65528
65529
65531
65533
65530
65527
16
25
104
165
272
312
273
206
214
223
229
293
323
391
480
477
513
525
551
631
658
679
693
687
740
814
857
947
999
1020
1073
1103
1154
1251
1284
1275
1304
1291
1352
1414
1402
1469
1518
1512
1588
1624
1632
1675
1699
1747
1809
1811
1843
1874
1848
1908
1951
1955
2039
2105
2128&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sometimes my 12 bit ADC gives a 16 bit value</title><link>https://devzone.nordicsemi.com/thread/125287?ContentTypeID=1</link><pubDate>Wed, 21 Mar 2018 08:25:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02c7700c-e4db-41fc-831e-cd940fbc4bb2</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Not sure how you have setup your SAADC, but there are four erratums that you can potentially hit:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;S&lt;a title="This anomaly applies to IC Rev. Rev 1, build codes QFAA-B00, QFAB-B00, CIAA-B00." href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.Rev1.errata/anomaly_832_74.html#anomaly_832_74"&gt;tarted events fires prematurely&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a title="This anomaly applies to IC Rev. Rev 1, build codes QFAA-B00, QFAB-B00, CIAA-B00." href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.Rev1.errata/anomaly_832_86.html#anomaly_832_86"&gt;Triggering START task after offset calibration may write a sample to RAM&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a title="This anomaly applies to IC Rev. Rev 1, build codes QFAA-B00, QFAB-B00, CIAA-B00." href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.Rev1.errata/anomaly_832_150.html#anomaly_832_150"&gt;EVENT_STARTED does not fire&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a title="This anomaly applies to IC Rev. Rev 1, build codes QFAA-B00, QFAB-B00, CIAA-B00." href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.Rev1.errata/anomaly_832_178.html#anomaly_832_178"&gt;END event firing too early&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Does your handling of the SAADC resemble any of these scenarios?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If not, could you elaborate on how often you see this, and how you sample your analog input from a fw-perspective?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Håkon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>