<?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>Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25072/inconsistent-adc-behaviour-with-dfu</link><description>Hi all, 
 I have a working ADC implementation (S130 + Application) and use it to measure an analog input continuously. 
 However if I use the same code on top of bootloader (S130+DFU+Application), it starts acting weird. When I check the ADC values</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Sep 2017 11:43:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25072/inconsistent-adc-behaviour-with-dfu" /><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98754?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 11:43:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95a5ca82-b0c3-424f-b716-485181fd4c64</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You will allways go through the bootloader when restarting the chip, to check for a valid application. If you are setting the pins in the bootloader code, this will be retained when executing the application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98755?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 09:31:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4712e832-0151-4dad-91b3-6b73d68a8d4c</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;Sorry, I didn&amp;#39;t notice your suggestion while writing my comment. Yes, changing pin conffiguration solved the issue. I don&amp;#39;t know if it is an expected behaviour but it seems the chip carries the pin configuration from DFU code to the application code. After correcting the pin configuration in app code, all looks fine. Thanks for all your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98753?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 09:04:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97f6f304-84da-4ee7-b074-59b94776b166</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;I found the root cause of the problem but it looked like a bug on SDK and I still need a solution for this.&lt;/p&gt;
&lt;p&gt;I noticed that I set the pin 1 as output in bootloader code as follows:&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg_output(1);
nrf_gpio_pin_set(1);&lt;/p&gt;
&lt;p&gt;But I am expecting the application code to reset this pin as input in my main code with the following code:&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg_input(1,NRF_GPIO_PIN_NOPULL);&lt;/p&gt;
&lt;p&gt;But it doesn&amp;#39;t. Do you have any idea why it is not reset as input in application code or may you offer a workaround for me?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98756?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 08:00:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78231274-e3a3-4ff1-9298-1a182b038dda</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Could you try configuring the GPIO pull settings using the GPIO pin number in the call to &lt;code&gt;nrf_gpio_cfg_input()&lt;/code&gt;? The define you are using will not evaluate to the correct GPIO pin number (AIN2 = P0.01):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_ADC_CONFIG_INPUT_2 = ADC_CONFIG_PSEL_AnalogInput2  = (4UL) 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try changing from this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_gpio_cfg_input(NRF_ADC_CONFIG_INPUT_2,NRF_GPIO_PIN_NOPULL);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_gpio_cfg_input(1,NRF_GPIO_PIN_NOPULL);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98752?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 06:30:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a1fb95c-e801-460d-93ba-96912048c590</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;Also may it still be a hardware issue when the problem occurs when I transmit the package over DFU only? Without DFU, it works as expected.&lt;/p&gt;
&lt;p&gt;Edit: In my previous messages, I have posted the following image and marked the HIGH value as expected analog value but now I noticed that it is not correct. Expected analog value must be at 1V level, but in the image it is about 3V.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://pasteboard.co/GK23FHl.jpg"&gt;pasteboard.co/GK23FHl.jpg&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So to summarize the issue:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;When we load the application on top of S130 by using nrfGo, it works as expected (we can measure the analog signal about 1V)&lt;/li&gt;
&lt;li&gt;When we load the application on top of S130+DFU by using NRF Toolbox, analog signal goes to 3V level during normal operation which should have been 1V actually, and draws a wavesquare each time ADC sampling occurs. Once the ADC sampling stopped, it goes to 3V level again. May it be an internal pullup-pulldown issue during ADC sampling?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98751?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 03:29:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d377060-e0c2-45d2-a19d-312ecad2274e</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;Actually I have a DK but it is really painful to revise the code to make it working on DK. There are too many inputs and outputs to make the code working as intended. Is there another way to understand the reason of voltage drop om AIN2 during ADC sampling?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98750?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 19:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e9f4b0f-63d9-49ba-99c1-fd21005394e9</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Do you have nRF51 DK that you can test the firmware on, just to make sure no hardware issues are causing this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98746?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 14:07:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7ea738f-7a90-4516-8a5f-acef619d3f6a</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;Here is a more detailed waveform of the AIN2 measurement:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://pasteboard.co/GK23FHl.jpg"&gt;link text&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98748?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 11:42:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25a8e1ff-c89b-4d5a-b2c6-c20623e90590</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;I am using a custom board and I don&amp;#39;t use P0.01 for any other purposes. It is only for measuring an analog input. When I check the signal with ossiloscope, I can see the expected waveform on the pin. However as soon as the sampling started it is voltage goes down as shared in the previous image link and returns to the expected level again. It is repeated at all sampling cycle.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98747?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 11:29:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:605219cf-6374-487b-9c42-70c6648ab150</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Are you testing this on the nRF51 DK, or some custom board? Have you configured GPIO P0.01 (AIN2) for any other purposes in the code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98749?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 09:50:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc84cf2f-68ae-47ef-ac3d-33e29e54a152</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;It is bootloader_secure in SDK_12.1.0 and I am using NRF Toolbox to transport the PKG.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98745?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 09:36:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43cfea93-3a6c-4fc0-a989-5a6de807422a</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Which SDK version and DFU transport are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98744?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 09:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01f0747d-ca42-43d3-8f8b-7a07da7796d7</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;An additional information: Problem is solved if I connect the analog circuit to NRF_ADC_CONFIG_INPUT_4 instead of NRF_ADC_CONFIG_INPUT_2. So the problem looks related to AIN2 when chip has DFU code. I am still looking for a solution :(&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98743?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2017 13:05:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0319388-7420-41df-9b3c-dfd982b035ae</guid><dc:creator>eyigiter</dc:creator><description>&lt;p&gt;Following is my ADC setup:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_gpio_cfg_input(NRF_ADC_CONFIG_INPUT_2,NRF_GPIO_PIN_NOPULL);

adc_channel_config.config.config.reference = NRF_ADC_CONFIG_REF_SUPPLY_ONE_THIRD
adc_channel_config.config.config.input = NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD;
adc_channel_config.config.config.ain = NRF_ADC_CONFIG_INPUT_2;

nrf_drv_adc_channel_enable(&amp;amp;adc_channel_config);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I am getting ADC samples at every 1ms. The issue occurs only if DFU is programmed to the chip. (S130+DFU+Application) By the way, you can see the waveform of NRF_ADC_CONFIG_INPUT_2 once the ADC is enabled where it is stable until ADC started.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://pasteboard.co/GJSeoqm.jpg"&gt;link text&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Inconsistent ADC Behaviour with DFU</title><link>https://devzone.nordicsemi.com/thread/98742?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2017 08:53:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3bf8aed-f4e2-464c-9ddb-865ab93fac55</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Could you elaborate on your statement &lt;em&gt;&amp;quot;are fluctuating in a large margin&amp;quot;&lt;/em&gt;? How is the ADC setup, and what sample rate are you running at? Is the issue only with DFU, or also with other BLE activity?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>