<?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>How to void repeated TWI start condition using nrf_drv_twi_tx()</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72557/how-to-void-repeated-twi-start-condition-using-nrf_drv_twi_tx</link><description>Hello, 
 I would like to use Nordic SDK libraries (currently I&amp;#39;m using SDK 17.0.2) to read and write on a FM24CL16B I2C F-RAM. 
 This device has the following writing workflow: 
 
 Following Nordic TWI example, the piece of code I&amp;#39;m using to write values</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Mar 2021 10:25:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72557/how-to-void-repeated-twi-start-condition-using-nrf_drv_twi_tx" /><item><title>RE: How to void repeated TWI start condition using nrf_drv_twi_tx()</title><link>https://devzone.nordicsemi.com/thread/298955?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 10:25:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f0adddb-a58c-4e69-b12c-a409a1d99710</guid><dc:creator>awneil</dc:creator><description>[quote userid="87195" url="~/f/nordic-q-a/72557/how-to-void-repeated-twi-start-condition-using-nrf_drv_twi_tx/298938#298938"] I have to copy up to 500 bytes at a time [/quote]
&lt;p&gt;Check the&amp;nbsp;&lt;strong&gt;nrf_drv_twi_tx()&lt;/strong&gt; documentation: the length parameter is a uint8_t - so you can&amp;#39;t do that anyhow.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__nrf__drv__twi.html#ga6c83eac2d358bc8fb5b53c53f22506b6"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__nrf__drv__twi.html#ga6c83eac2d358bc8fb5b53c53f22506b6&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;An nRF52832 has at least &lt;strong&gt;32K&lt;/strong&gt; RAM - so finding a 256 (or 257?) byte buffer shouldn&amp;#39;t be too hard?&lt;/p&gt;
[quote userid="87195" url="~/f/nordic-q-a/72557/how-to-void-repeated-twi-start-condition-using-nrf_drv_twi_tx/298938#298938"]What can I do?[/quote]
&lt;p&gt;Again, have you looked at the register level - ie, is this just a software API restriction, or is it an actual hardware limitation?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to void repeated TWI start condition using nrf_drv_twi_tx()</title><link>https://devzone.nordicsemi.com/thread/298938?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 09:42:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44d44ca2-83ba-4711-8e85-8633390f9391</guid><dc:creator>StefXinet</dc:creator><description>&lt;p&gt;a big problem caused by having to put the address byte and the data bytes in the same array is that I don&amp;#39;t know how to handle transmissions of a lot of data. I have to copy up to 500 bytes at a time and I cannot copy each time to RAM in a new array of 501 bytes, 1 byte of address and 500 bytes of data.&lt;/p&gt;
&lt;p&gt;What can I do?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to void repeated TWI start condition using nrf_drv_twi_tx()</title><link>https://devzone.nordicsemi.com/thread/298805?ContentTypeID=1</link><pubDate>Tue, 09 Mar 2021 16:19:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ffb6e05-aa07-4b7d-a422-d34315e3bee8</guid><dc:creator>StefXinet</dc:creator><description>&lt;p&gt;Dear awneil,&lt;/p&gt;
&lt;p&gt;having the address and the data in the same array is not convenient because in this way the function&amp;nbsp;nrf_drv_twi_tx() that has the same name in SDK 17 and SDK11 accepts the same parameters but produces two different outputs (I checked with the oscilloscope).&lt;br /&gt;The only workaround seems to be to copy each time the address plus all the data in a single array and call the function &lt;span&gt;function&amp;nbsp;&lt;/span&gt;&lt;span&gt;nrf_drv_twi_tx()&lt;/span&gt;, in this way it wastes time, and also RAM is wasted&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to void repeated TWI start condition using nrf_drv_twi_tx()</title><link>https://devzone.nordicsemi.com/thread/298803?ContentTypeID=1</link><pubDate>Tue, 09 Mar 2021 16:14:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad31d9b8-a395-43ce-a7d6-6cfdd475a23b</guid><dc:creator>awneil</dc:creator><description>[quote userid="87195" url="~/f/nordic-q-a/72557/how-to-void-repeated-twi-start-condition-using-nrf_drv_twi_tx/298726#298726"]is there a way to get the code to work without putting both the address and the data in the same array[/quote]
&lt;p&gt;What&amp;#39;s the problem with having them in the same array?&lt;/p&gt;
&lt;p&gt;It doesn&amp;#39;t look like the API supports it - dunno if you could do it with direct register access?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to void repeated TWI start condition using nrf_drv_twi_tx()</title><link>https://devzone.nordicsemi.com/thread/298726?ContentTypeID=1</link><pubDate>Tue, 09 Mar 2021 13:42:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58dc33ba-e79a-48ff-8164-d358fc4f9112</guid><dc:creator>StefXinet</dc:creator><description>&lt;p&gt;Yes, this could be a tricky workaround.&lt;/p&gt;
&lt;p&gt;Im also using older SDK (ver 11) for nRF51 and for nRF51 there is no start repeated condition and no slave address repeated send.&lt;/p&gt;
&lt;p&gt;So is there a way to get the code to work without putting both the address and the data in the same array?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to void repeated TWI start condition using nrf_drv_twi_tx()</title><link>https://devzone.nordicsemi.com/thread/298718?ContentTypeID=1</link><pubDate>Tue, 09 Mar 2021 13:21:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9ac031e-61c8-40a5-9aa1-2f4e8e64bf84</guid><dc:creator>awneil</dc:creator><description>[quote userid="87195" url="~/f/nordic-q-a/72557/how-to-void-repeated-twi-start-condition-using-nrf_drv_twi_tx"]the problem I have is that the start condition and the slave address are sent twice[/quote]
&lt;p&gt;that&amp;#39;s because you do two separate I2C transactions. You need to do them as just one - make the &amp;#39;Word Address&amp;#39; the first byte of the buffer that you send:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;p_buff[0] = word_address;
p_buff[1] = data_byte_1;
p_buff[2] = data_byte_2;

err_code = nrf_drv_twi_tx( &amp;amp;twi_instance, 0x50, p_buff, 3, false );&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>