<?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>Can&amp;#39;t read or write any TWI registers after moving to the app_twi library</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14237/can-t-read-or-write-any-twi-registers-after-moving-to-the-app_twi-library</link><description>Hi there, 
 In the process of moving from SDK 10 to SDK 11, I&amp;#39;ve also been migrating an accelerometer driver over from using straight nrf_drv_twi code to the higher level app_twi library. The driver has stopped working completely. 
 Although I can read</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 04 Jun 2016 12:39:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14237/can-t-read-or-write-any-twi-registers-after-moving-to-the-app_twi-library" /><item><title>RE: Can't read or write any TWI registers after moving to the app_twi library</title><link>https://devzone.nordicsemi.com/thread/54378?ContentTypeID=1</link><pubDate>Sat, 04 Jun 2016 12:39:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e742b3e-6b9b-4724-b8ed-b38c25ec340b</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;This was down to me calling app_twi_perform() and passing 1 as the number of transfers. Because of that confusing &amp;quot;write before read&amp;quot; idiom with I2C, it&amp;#39;s actually two transfers, one for the write and one for the read. Best explained here for anyone struggling with the same issue:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.robot-electronics.co.uk/i2c-tutorial"&gt;www.robot-electronics.co.uk/i2c-tutorial&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't read or write any TWI registers after moving to the app_twi library</title><link>https://devzone.nordicsemi.com/thread/54377?ContentTypeID=1</link><pubDate>Sat, 04 Jun 2016 11:22:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8177dcb2-5ab6-473e-b275-df0e2e382aab</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;@Ole Bauck Thanks. Have fixed that, but there must be something else. New code attached above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't read or write any TWI registers after moving to the app_twi library</title><link>https://devzone.nordicsemi.com/thread/54376?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2016 11:01:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73b6a05c-65bd-4fee-b6b0-bc0ff25ad258</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;I would define the transfer as static or else it is placed on the stack and destroyed when the function exits, I think that is what is causing your problems. &lt;code&gt;App_twi_perform()&lt;/code&gt; will call &lt;code&gt;app_twi_schedule()&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>