<?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>difference value of mbed analog read and keil adc</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10888/difference-value-of-mbed-analog-read-and-keil-adc</link><description>Hello, 
 I am using keil uvision 5.17, sdk 9.0.0 and sd 130. 
 Once I programmed whole application through mbed, 
 Then I moved into keil and implemented all function. 
 but only ADC is not implemented. 
 in mbed : 
 analogIn btt(p5);
printf(&amp;quot;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Dec 2015 11:48:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10888/difference-value-of-mbed-analog-read-and-keil-adc" /><item><title>RE: difference value of mbed analog read and keil adc</title><link>https://devzone.nordicsemi.com/thread/40719?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 11:48:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6733fd00-d3e6-4aef-ab95-79c2ead77a4c</guid><dc:creator>Anders Strand</dc:creator><description>&lt;p&gt;Create a new question for this&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference value of mbed analog read and keil adc</title><link>https://devzone.nordicsemi.com/thread/40720?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 02:07:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e186f72-82c8-48cc-b2e9-444d7e499aec</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Thank you :)
I have a question, I am using servo motor with BLE.
So I set data written interrupt from smart phone, and trying control servo in interrupt callback.
The problem is servo didn&amp;#39;t work.. Is this problem matched with what you tell me?&lt;/p&gt;
&lt;p&gt;Therefore I put the flag in written callback, control servo motor in while() in main(), and it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference value of mbed analog read and keil adc</title><link>https://devzone.nordicsemi.com/thread/40718?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2015 09:47:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64a80748-30d9-4014-9637-d9003196237d</guid><dc:creator>Anders Strand</dc:creator><description>&lt;p&gt;Be careful when executing code withing an interrupt with priority NRF_APP_PRIORITY_HIGH. Long operations like printf should be avoided as it can impact BLE performance. This will not solve your problem, but is just a general tip :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference value of mbed analog read and keil adc</title><link>https://devzone.nordicsemi.com/thread/40722?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2015 04:53:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:875cefce-fb6d-4aa3-9e79-4fab05c7330f</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Thank you, It works!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: difference value of mbed analog read and keil adc</title><link>https://devzone.nordicsemi.com/thread/40721?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2015 02:56:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:878a153b-fdca-4827-9d9e-e183e0fa200d</guid><dc:creator>monpetit</dc:creator><description>&lt;p&gt;Because of the difference of the ADC reference. The mbed ADC API uses NRF_ADC_CONFIG_REF_SUPPLY_ONE_THIRD(1/3 of power supply) as a reference, and your adc_config() uses the default configuration of nRF5x SDK(1.2 V reference). Check the values of NRF_ADC_CONFIG_DEFAULT and &lt;code&gt;void analogin_init(analogin_t *obj, PinName pin)&lt;/code&gt; of the mbed ADC API.&lt;/p&gt;
&lt;p&gt;nrf_adc.h (nRF5x SDK):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/** Default ADC configuration. */
#define NRF_ADC_CONFIG_DEFAULT { NRF_ADC_CONFIG_RES_10BIT, \
				 NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD,   \
				 NRF_ADC_CONFIG_REF_VBG }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;analogin_api.c (mbed):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void analogin_init(analogin_t *obj, PinName pin)
{
    ...
    NRF_ADC-&amp;gt;CONFIG = (ADC_CONFIG_RES_10bit &amp;lt;&amp;lt; ADC_CONFIG_RES_Pos) |
                      (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling &amp;lt;&amp;lt; ADC_CONFIG_INPSEL_Pos) |
                      (ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling &amp;lt;&amp;lt; ADC_CONFIG_REFSEL_Pos) |
                      (analogInputPin &amp;lt;&amp;lt; ADC_CONFIG_PSEL_Pos) |
                      (ADC_CONFIG_EXTREFSEL_None &amp;lt;&amp;lt; ADC_CONFIG_EXTREFSEL_Pos);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>