<?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>TWI issue migrating SDK8 -&amp;gt; SDK11</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12033/twi-issue-migrating-sdk8---sdk11</link><description>I&amp;#39;m migrating an app from SDK8 to SDK11 and I&amp;#39;m getting errors using TWI to communicate with my IMU (Invensense 9250). I first tried it on a nRF52 DK (Eng B) and then went back to my 51 DK to rule out any hardware issues. 
 I&amp;#39;m using nrf_drv_twi in a</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Jun 2016 14:33:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12033/twi-issue-migrating-sdk8---sdk11" /><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45552?ContentTypeID=1</link><pubDate>Tue, 14 Jun 2016 14:33:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29f44590-6177-4f9d-a865-a4bd4ebba2cd</guid><dc:creator>kirkus</dc:creator><description>&lt;p&gt;@Spirit I have a write function that combines the address and payload into one shot (the IMU SDK I&amp;#39;m using requires this signature):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int nrf5x_i2c_write(unsigned char slave_addr,
				  unsigned char reg_addr,
				  unsigned char length,
                              unsigned char const *data) 
{
	ret_code_t err_code;
	
	unsigned char buf[sizeof(reg_addr) + length];
	buf[0] = reg_addr;
	memcpy(&amp;amp;buf[1], data, length);
	
	err_code = nrf_drv_twi_tx(&amp;amp;p_twi_instance, slave_addr, buf, sizeof(buf), false);
  
	return err_code;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45553?ContentTypeID=1</link><pubDate>Tue, 14 Jun 2016 14:13:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ae614b0-79b2-42df-be1a-dbce4c4f7557</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;A little update on the issue: It turns out that the root cause is a hardware limitation in nRF52. As opposed to the nRF51 the nRF52 is not capable of sending TX transmissions back-to-back without a repeated start and new slave address. The SDK team chose to make a consistent TWI driver with the same feature set on both nRF51 and nRF52 in SDK 11. So removing the feature from the driver was a conscious, although inconvenient, choice and it will require a redesign of the TWI hardware in nRF52 to bring it back. When or if that will happen is impossible to say. In the meantime the only option is to use nRF51 and SDK &amp;lt;= 10.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45551?ContentTypeID=1</link><pubDate>Thu, 24 Mar 2016 22:40:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09551c44-c17c-4ba8-a3c5-f082cf734e65</guid><dc:creator>Spirit</dc:creator><description>&lt;p&gt;@kirkus could you please tell me how did you modified the code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45550?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2016 16:49:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68bdcf98-ccf2-481a-b20c-91b7cb4eb562</guid><dc:creator>kirkus</dc:creator><description>&lt;p&gt;I modified the code as you suggested and it solved the problem. Thank you for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45549?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2016 16:03:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef0c4c44-6189-47fe-a61c-b1c15f7aabf7</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The problem is in nrf5x_i2c_write(..) where a repeated tx is used. This does unfortunately not work in SDK11 (but works on SDK 10 and prior). The second nrf_drv_twi_tx(..) call will send out the slave address in addition to the data, which will make the MPU device fail. We have made an internal request to get the repeated tx feature back again. For now you will have to merge the reg_addr and data array and send them with one nrf_drv_twi_tx(..) command.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45548?ContentTypeID=1</link><pubDate>Tue, 01 Mar 2016 23:13:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37a51761-6bd5-4474-b361-44d0826db7dc</guid><dc:creator>kirkus</dc:creator><description>&lt;p&gt;Sorry, not sure how that got messed up. Added new attachment that compiles properly (template_pca10040 project file).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45547?ContentTypeID=1</link><pubDate>Tue, 01 Mar 2016 13:52:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43321449-493e-4350-9951-e2509d7fe1c2</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The project does not compile out of the box, can you upload a project that does?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45546?ContentTypeID=1</link><pubDate>Sun, 28 Feb 2016 18:16:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5da646cc-e98e-4a90-8bb0-933295a2c26b</guid><dc:creator>kirkus</dc:creator><description>&lt;p&gt;I have made changes to handle the error code, but it is still not working under SDK 11. SDK 8 is still working fine. I have attached a sample project with a brief readme.txt to explain the issue. Any further suggestions would be very helpful, thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45545?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2016 09:35:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d33c46b3-5238-456c-beaa-10bad8b1104c</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;I had to go into the function to see what caused it to return NRF_ERROR_INTERNAL. Ideally we should have a better return/error code. I will make a request internally for this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45544?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2016 13:35:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25da23e1-652e-4671-9a8b-e978eec37bd7</guid><dc:creator>kirkus</dc:creator><description>&lt;p&gt;Yes, I defined DEBUG so it would stop in the endless loop and I could get a smaller logic trace. I was not aware that the NRF_ERROR_INTERNAL was expected from a NACK when not using an event handler, thank you for clarifying.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI issue migrating SDK8 -&gt; SDK11</title><link>https://devzone.nordicsemi.com/thread/45543?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2016 10:28:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e78dd928-55fe-4bd6-96b7-18d50239ee36</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;You are receiving a NACK and the function (nrf_drv_twi_tx or nrf_drv_twi_rx) is returning NRF_ERROR_INTERNAL, which is done when no event handler is used. APP_ERROR_CHECK will either reset your chip or go into an infinite while loop depending on if DEBUG is defined, see &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;here&lt;/a&gt;. Judging your capture and the problem it looks like it&amp;#39;s in an infinite while loop (not doing anything).&lt;/p&gt;
&lt;p&gt;You should add an if sentence to handle NRF_ERROR_INTERNAL from the twi transfer functions or use twi with event handler and check for NACK in this handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>