<?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 write: unable to write without a repeat start</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39764/twi-write-unable-to-write-without-a-repeat-start</link><description>Hello, 
 We are in the process of migrating to the nrf52840 and as such have decided to use the latest SDK (15.2). 
 As part of the migration we are trying to do a TWI write without a stop or repeated start condition using the nrf twi manager (by dividing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Oct 2018 20:22:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39764/twi-write-unable-to-write-without-a-repeat-start" /><item><title>RE: TWI write: unable to write without a repeat start</title><link>https://devzone.nordicsemi.com/thread/154733?ContentTypeID=1</link><pubDate>Fri, 26 Oct 2018 20:22:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdf32eda-0b8d-4fe9-903f-16789d58cdfe</guid><dc:creator>JPablo</dc:creator><description>&lt;p&gt;Alright, thanks for the help. We will use it in that way then.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI write: unable to write without a repeat start</title><link>https://devzone.nordicsemi.com/thread/154658?ContentTypeID=1</link><pubDate>Fri, 26 Oct 2018 11:03:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:472d2fb5-9512-43c1-97f7-4fd1f867a4e7</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;OK actually digging around I see that it is not possible to omit start sequence between two separate TX transactions. Normally the driver is able to omit a stop condition between two transaction by using the short available in the hardware&amp;nbsp;&lt;span&gt;LASTTX_SUSPEND. But I am pretty sure that your sensors get confused here.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;in your workaround you avoid a stop and repeated start by keeping all of them in the same transaction. I think that is the best way to do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI write: unable to write without a repeat start</title><link>https://devzone.nordicsemi.com/thread/154648?ContentTypeID=1</link><pubDate>Fri, 26 Oct 2018 10:29:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8a5f7c0-f2ad-4878-8932-d24af8fb3a6d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am sorry, I totally misunderstood your initial question and thought that nRF is on the slave side.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now back to your question, I think the source of your problem is that there is no configuration in twi_manager that gives you a sequential operation without a repeated start. The flag is only to omit a stop but there is nothing to omit a repeated start. I see that there is no easy solution for this without changing too much of twi_manager and risking untested changes.&lt;/p&gt;
&lt;p&gt;Let me have a look at nRFX drivers to see if we can manage to do this in easier way.&lt;/p&gt;
&lt;p&gt;For now it looks to me that your way of packing slave address and register address seems to be the simplest way without changing any SDK library or driver code.&lt;/p&gt;
&lt;p&gt;I will be back to you once I experiment a bit with nrfx drivers&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI write: unable to write without a repeat start</title><link>https://devzone.nordicsemi.com/thread/154344?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 17:02:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae84e7e5-31d5-4f98-b7bc-b14598c547ab</guid><dc:creator>JPablo</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the quick reply,&lt;/p&gt;
&lt;p&gt;As for the slave response, we are not setting up the slaves, these are sensors we need to communicate with which drivers use the format:&lt;/p&gt;
&lt;p&gt;CHIP ADDRESS&lt;br /&gt;REGISTER ADDRESS&lt;br /&gt;BUFFER&lt;br /&gt;BUFFER LENGTH&lt;/p&gt;
&lt;p&gt;to send a twi command, and we are trying to preserve this when passing it to either the twi driver or the twi manager (which we have currently set up for this). We are able to communicate with the sensors if we do:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;CHIP ADDRESS&lt;br /&gt;BUFFER[0]=REGISTER ADDRESS&lt;br /&gt;BUFFER[1..n]= data to write&lt;br /&gt;BUFFER LENGTH&lt;/p&gt;
&lt;p&gt;however, this is not always possible with the way that our drivers were written in the past. Basically, we are trying to avoid having to allocate memory for every call where all we do is copy the register address to mem[0] and the data to mem[1..n] in order to use a single call of the driver/manager.&lt;/p&gt;
&lt;p&gt;This is the way its being used at the moment:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;twi_write( const uint8_t slave_chip_address, uint8_t slave_reg_address, void* data_buffer, const uint8_t data_length )&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; static nrf_twi_mngr_transfer_t addr_packet;&lt;br /&gt;&amp;nbsp; static nrf_twi_mngr_transfer_t wr_packet;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // initialize packet transfer descriptors&lt;br /&gt;&amp;nbsp; // address packet (always write on first packet)&lt;br /&gt;&amp;nbsp; addr_packet.operation = slave_chip_addr; // already formatted to read/write&lt;br /&gt;&amp;nbsp; addr_packet.p_data = &amp;amp;slave_reg_address;&lt;br /&gt;&amp;nbsp; addr_packet.length = 1;&lt;br /&gt;&amp;nbsp; addr_packet.flags = NRF_TWI_MNGR_NO_STOP; // is there a way to NO_RESTART?&lt;br /&gt;&amp;nbsp; // data/register to read/write packet&lt;br /&gt;&amp;nbsp; wr_packet.operation = &lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt; slave_chip_address; // already formatted to read/write&lt;/span&gt;&lt;br /&gt;&amp;nbsp; wr_packet.p_data = data_buffer;&lt;br /&gt;&amp;nbsp; wr_packet.length = data_length;&lt;br /&gt;&amp;nbsp; wr_packet.flags = NULL;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // prepare &amp;quot;whole&amp;quot; packet for sending&lt;br /&gt;&amp;nbsp; nrf_twi_mngr_transfer_t twi_wr_packets[] =&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; addr_packet,&lt;br /&gt;&amp;nbsp; &amp;nbsp; wr_packet&lt;br /&gt;&amp;nbsp; };&lt;/p&gt;
&lt;p&gt;&amp;nbsp; nrf_twi_mngr_perform( &amp;amp;nrf_twi0_mngr, NULL, &lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;twi_wr_packets&lt;/span&gt;, 2, NULL );&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;But as said before the only way to make it work as we need it to (image in original post) is to prepare a single transfer and pass it to twi_mngr_perform as such.&lt;/p&gt;
&lt;p&gt;Hope this clarifies the issues we are having, let me know if I can provide more information/clarification.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI write: unable to write without a repeat start</title><link>https://devzone.nordicsemi.com/thread/154293?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 13:09:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6784a53c-2170-47d5-a5ee-a9f1b125fa17</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;long time ago I tested that the TWIS module responds to continuous writes (no stop bits in between) upto 255 bytes. I am not sure how you have configured the receiver of TWIS when the master is writing to it. Could you attach some code snippets on your configuration and the code where you are configuring TWIS to receive commands.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>