<?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>porting from SDK 11</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27978/porting-from-sdk-11</link><description>I&amp;#39;m trying to port my project from SDK11 to SDK14.
I am having troubles understanding how the drivers supposed to be used. 
 In the files nrf_peripheralXXX_drv.c there is often a state variable m_state,
which is changed when the init or stop function</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Dec 2017 15:52:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27978/porting-from-sdk-11" /><item><title>RE: porting from SDK 11</title><link>https://devzone.nordicsemi.com/thread/110383?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 15:52:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7489cb94-925c-4ebf-a66b-471620e335d6</guid><dc:creator>TY</dc:creator><description>&lt;p&gt;Thank you very much, the hint with &lt;code&gt;DEBUG_NRF&lt;/code&gt; could have saved my some days of debugging.
Should have asked before :-)&lt;/p&gt;
&lt;p&gt;Cheers Timur&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: porting from SDK 11</title><link>https://devzone.nordicsemi.com/thread/110382?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 15:22:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fce3eeb-4576-47e8-a2d2-c73adf71c2dd</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In general, there is a difference between configuring, enabling/disabling, and starting/stopping a peripheral. Initializing a driver with some nrf_drv_xx_init() function is yet another thing.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When configuring a peripheral you tell it which pins to use, how fast to sample a signal, how much data to transfer, etc. dependent on the peripheral.&lt;/li&gt;
&lt;li&gt;When &lt;em&gt;Enabled&lt;/em&gt;, peripherals override the PINDIR and PORT values set in the GPIO module. In other words, it is at this moment that the peripheral takes control over the GPIOs that you want to use.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Starting&lt;/em&gt; a peripheral with the START task makes the peripheral perform its actual task. Like transferring data over a serial interface or measure a voltage with the comparator. It is at this moment the peripheral requests the necessary resources like clocks, and starts to draw current.&lt;/li&gt;
&lt;li&gt;When initiating a driver you tell your application which particular peripheral to use. And if applicable, you also tell it which instance of the peripheral (TWI0, TWI1, etc,) you want. You also tell it which pins to use and a bunch of different stuff specific to the peripheral.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When using a peripheral the general rule of thumb is: Configure -&amp;gt; Enable -&amp;gt; Start.
When you want to turn off the peripheral you should: Stop -&amp;gt; Disable -&amp;gt; (Enter sleep mode, reconfigure, etc.). This will make sure that you won&amp;#39;t see any weird glitches on the GPIOs when preparing the peripheral.&lt;/p&gt;
&lt;p&gt;So typically, in the nrf_drv_peripheral_init() functions we configure pins, etc., and enable the peripheral. Some drivers also have separate enable functions. Then in the end, you most likely call some sort of nrf_drv_peripheral_start() function to start the actual measurements or transfers. You should never use the low level hardware abstraction layers (HAL) in e.g. nrf_comp.h. At least not when you use one of our drivers. Then they should only be used by the drivers themselves. So when using drivers the rule of thumb is: init() -&amp;gt; (enable()) -&amp;gt; start(). To disable the peripheral you should: stop() -&amp;gt; (disable()) -&amp;gt; uninit().&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The ASSERT macro was added to the driver to simplify debugging and make it easier to pinpoint exactly where an error occurs. It should be possible though, to &amp;quot;disable&amp;quot; the ASSERT macro by making sure &lt;em&gt;not&lt;/em&gt; to define &lt;code&gt;DEBUG_NRF&lt;/code&gt; or &lt;code&gt;DEBUG_NRF_USER&lt;/code&gt;. As you can see in nrf_assert.h, these two defines decide whether the ASSERT macro sends your application into a system reset or endless while loop or if it just ignores the ASSERT and moves on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>