<?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>Need a path through the TWI/I2C configuration maze.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45771/need-a-path-through-the-twi-i2c-configuration-maze</link><description>Sorry, folks, for asking a newbie question. Well, maybe it isn&amp;#39;t such a newbie question after all, but some gaps in the SDK documentation and examples. Specifically, I&amp;#39;m: 
 
 Using SDK 15.2.0 with an nRF52832 target, building with SES 4.12. 
 Trying to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Apr 2019 17:49:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45771/need-a-path-through-the-twi-i2c-configuration-maze" /><item><title>RE: Need a path through the TWI/I2C configuration maze.</title><link>https://devzone.nordicsemi.com/thread/180381?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2019 17:49:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05183c85-195c-4ea5-abd9-91ca6e66f6b3</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Yes, you can pass NULL to the user_function parameter if you don&amp;#39;t need that feature. Just read the documentation for those two functions (schedule and perform) and you should be able to understand. It&amp;#39;s pretty self-explanatory.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need a path through the TWI/I2C configuration maze.</title><link>https://devzone.nordicsemi.com/thread/180377?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2019 17:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78c23904-5081-4080-9727-5ce78299c54d</guid><dc:creator>Mike Wirth</dc:creator><description>&lt;p&gt;Got it (all but the last sentence anyway; will check that out). &amp;nbsp;Will look at the example code again.&lt;/p&gt;
&lt;p&gt;BTW, I&amp;#39;m presuming that I can put NULL in for the callback argument to the transaction if I don&amp;#39;t need a callback (e.g., if I&amp;#39;m using perform) and that&amp;#39;ll work OK.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need a path through the TWI/I2C configuration maze.</title><link>https://devzone.nordicsemi.com/thread/180355?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2019 15:04:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9b1ec53-e675-4e8e-b088-424e08abd93e</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Are you looking at the twi_master_using_nrf_twi_mngr example project?&lt;/p&gt;
&lt;p&gt;That one uses blocking calls, that&amp;#39;s why there&amp;#39;s no callback. With the manager you have two ways of using the module: nrf_twi_mngr_schedule() and nrf_twi_mngr_perform(). Schedule is non-blocking and Perform is blocking.&lt;/p&gt;
&lt;p&gt;When you use schedule you can specify a function to be called when the scheduled transaction&amp;nbsp;is finished&amp;nbsp;(callback).&lt;/p&gt;
&lt;p&gt;When you use perform you can specify a function that will be called while the transfer is in progress.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need a path through the TWI/I2C configuration maze.</title><link>https://devzone.nordicsemi.com/thread/180352?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2019 14:45:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:844cb876-c0be-402a-ad86-8bb2473afd45</guid><dc:creator>Mike Wirth</dc:creator><description>&lt;p&gt;Thanks, Andy, for the quick reply.&lt;/p&gt;
&lt;p&gt;Attempting to forge ahead by adapting the &amp;quot;nrfx&amp;quot; example in Ayden&amp;#39;s post (linked in the middle of my original post above). &amp;nbsp;In his case, he defines an interrupt handler. &amp;nbsp;All well and good. &amp;nbsp;But in the TWIM example app, I don&amp;#39;t see a handler being defined, i.e., the&amp;nbsp;&lt;span&gt;nrf_twi_mngr_callback_t type is never used. &lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;Does this mean that the TWIM library supplies its own, internal handler? &amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;And the user can override(?)/supplement(?) its behavior by&amp;nbsp;defying a new&amp;nbsp;&lt;/span&gt;function of type&amp;nbsp;&lt;span&gt;nrf_twi_mngr_callback_t? &amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;How&amp;nbsp;would this function be registered with the TWIM Mngr instance?&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Without my own interrupt handler, does this mean that I have two possible ways of executing transactions:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;BLOCKING MODE: Zero or more&amp;nbsp;nrf_twi_mngr_schedule calls to queue up some&amp;nbsp;&lt;/span&gt;transactions, followed by a&amp;nbsp;&lt;span&gt;nrf_twi_mngr_perform call to queue the last one and wait for completion of the full sequence, or&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;NON-BLOCKING MODE: Schedule all transactions with&amp;nbsp;nrf_twi_mngr_schedule calls and use&amp;nbsp;nrf_twi_mngr_is_idle to check on the state of their completion?&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Or do I have this all wrong, and a&amp;nbsp;handler is&amp;nbsp;&lt;/span&gt;specified for each transaction within the&amp;nbsp;&lt;span&gt;nrf_twi_mngr_transaction_t struct?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Mike (searching through the SDK docs and TWIM sample code for enlightenment)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need a path through the TWI/I2C configuration maze.</title><link>https://devzone.nordicsemi.com/thread/180302?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2019 12:05:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcaa1f21-dcdf-4b65-ac6f-97d1c1aabb30</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I would recommend you to take a look at the&amp;nbsp;&lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/lib_nrf_twi_mngr"&gt;nrf_twi_mngr&lt;/a&gt;&amp;nbsp;library. That&amp;#39;s what I&amp;#39;m using and it&amp;#39;s pretty straight forward. You would have to write a similar wrapper to work with the nrf_drv_twim library anyway, otherwise it&amp;#39;s quite clumsy to use those functions directly.&lt;/p&gt;
&lt;p&gt;Regarding your questions: I think not even the guys at Nordic know exactly the differences between the nrf_drv_xxx and the nrfx_xxx libraries. I&amp;#39;ve seen several threads where they recommend using one instead of the other.&lt;/p&gt;
&lt;p&gt;The sdk_config.h thing is also a bit of a mess, especially if you don&amp;#39;t use the wizard thingy. It became even worse now when they split and duplicated NRF_ and NRFX_ definitions. There&amp;#39;s a &amp;quot;glue&amp;quot; header file that redefines all the NRFX_ macros with the legacy ones (I learned that the hard way).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>