<?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>nRF52 reading AIN0 to AIN4 ... AIN4 fails</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14938/nrf52-reading-ain0-to-ain4-ain4-fails</link><description>EDIT 
I think there is somewhere in KEIL or nrf libraries a bad pointer type alignement . 
 The correct pointer is given as uint_32_t ( NRF_SAADC-&amp;gt;RESULT.PTR = (uint32_t)&amp;amp;adcr; )
but the result buffer uint32_t adcr[] is composed in this way : 
 ADCR</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Jul 2016 20:48:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14938/nrf52-reading-ain0-to-ain4-ain4-fails" /><item><title>RE: nRF52 reading AIN0 to AIN4 ... AIN4 fails</title><link>https://devzone.nordicsemi.com/thread/56987?ContentTypeID=1</link><pubDate>Thu, 07 Jul 2016 20:48:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:276364a2-da77-4c62-9534-84aaec967df3</guid><dc:creator>Carsten Wulff</dc:creator><description>&lt;p&gt;Hi Maurizio,&lt;/p&gt;
&lt;p&gt;As specified in the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html?cp=2_2_0_36_4_3#saadc_operationmodes_scan"&gt;PS&lt;/a&gt; SAADC stores 16-bit signed integers.&lt;/p&gt;
&lt;p&gt;I usually use&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int16_t ex1_result[EX1_COUNT];
NRF_SAADC-&amp;gt;RESULT.PTR = (uint32_t)&amp;amp;ex1_result[0];
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I would recommend always using signed integers for SAADC, because even in single ended mode you can get negative values if you have a close to zero input.&lt;/p&gt;
&lt;p&gt;I have a &amp;quot;scan multiple channel&amp;quot; barebone example at &lt;a href="https://github.com/wulffern/nRF52_saadc_barebone/blob/master/src/ex1_scan_multiple_channels.c"&gt;nRF52_saadc_barebone&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 reading AIN0 to AIN4 ... AIN4 fails</title><link>https://devzone.nordicsemi.com/thread/56986?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2016 16:38:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9146237-2417-4e1f-bd70-d89151a6d5f4</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Maurizio&lt;/p&gt;
&lt;p&gt;Good that you found a workaround. I have actually not configured SAADC manually that much as you are doing. I have used the nrf_drv_saadc to do the details for me. The example in the nrf5 SDK uses the driver and so do the &lt;a href="https://github.com/NordicSemiconductor/nRF52-ADC-examples"&gt;saadc examples on Github&lt;/a&gt;, in case you are interested.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>