<?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>nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21337/nrf_drv_twi-dynamically-adjust-receiving-length</link><description>Hi, 
 I am porting a NCI (Nfc Controller Interface) driver to the nRF52. One of the things I am struggling with is that, when reading from the device, the amount of data to be read is part of the first 3 bytes.
Is it possible to set up a transfer of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 05 Feb 2018 16:23:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21337/nrf_drv_twi-dynamically-adjust-receiving-length" /><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/119807?ContentTypeID=1</link><pubDate>Mon, 05 Feb 2018 16:23:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4b961f4-02c9-4007-a3b5-2d6f6d3b7906</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The point of the DMA is that the transfers should be able to operate without CPU interaction. If you need to check the received bytes, you can always use the legacy TWI module that is still available in the nRF52832 and nRF52840 ICs. Which specific device are you interfacing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/119495?ContentTypeID=1</link><pubDate>Fri, 02 Feb 2018 10:04:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a41842ad-db18-45f0-8545-56d4c74fcdba</guid><dc:creator>Phil Young</dc:creator><description>&lt;p&gt;The system is using I2C in&amp;nbsp;a completely normal manner, but the question is how to know when 1 or 3 bytes have been read in order to determine from the response whether to continue with the read operation. With the interrupt driven device it is possible, but not when using DMA.&lt;/p&gt;
&lt;p&gt;In this application&amp;nbsp;the slave always responds with 3 bytes of data but can respond with between 3 and 64 bytes, with the length being encoded in the first bytes. Once an I2C transaction has started the slave cannot terminate it in any other way than stretching the clock long enough to cause a timeout which then wastes time in a recovery process and severely limits the throughout, so a solution to allow the master to detect when 3 bytes have been received ( or even 1 byte ) and use that to determine the length of the read transaction is required for efficiency. In the SW (interrupt driven ) case it is trivial, but with the DMA driven architecture currently implemented it appears impossible).&lt;/p&gt;
&lt;p&gt;With the current implementation of the DMA the length of an I2C read transaction must be determined before the read is initiated which is inadequate for this application, hence the request for a way to generate an event after the 3rd byte has been received without terminating the I2C transaction so that SW can interrogate the length and set the actual remaining transaction length before allowing the DMA driven operation to continue.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/83563?ContentTypeID=1</link><pubDate>Thu, 09 Nov 2017 10:16:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a78726d-834f-447b-b335-1e82685c8426</guid><dc:creator>Phil Young</dc:creator><description>&lt;p&gt;I have to say Nordic is not alone in this respect, but it is frustrating the amount of time I have wasted with manufacturers datasheets, often finding the information is incorrect. As a developer developing a product with huge market potential and expecting to ship potentially millions of units I feel justified in expecting better documentation, I am the CTO of a company using the product in a volume application, not a hobbyist, and the time wasted with poor documentation from all manufacturers is a serious concern to me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/83562?ContentTypeID=1</link><pubDate>Thu, 09 Nov 2017 09:33:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b5f9461-abd5-4882-b0dc-8393631106a9</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;(not mentioning that Nordic has large documentation base to both HW and SW and while it&amp;#39;s hardly perfect some could be offended by your stupid claim about poor documentation &amp;quot;as usual&amp;quot;... can you name any competitor with better documentation to set some benchmark?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/83564?ContentTypeID=1</link><pubDate>Thu, 09 Nov 2017 09:30:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57b67b43-1021-4182-9779-51f61e16dedb</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Btw. how this relates to the original question where the problem was &amp;quot;how to find out that I2C transfer ended with less bytes received then buffer length&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/83566?ContentTypeID=1</link><pubDate>Thu, 09 Nov 2017 09:29:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26e7de2a-4964-4105-85b3-0a99d3934225</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Then this is not how normal I2C works, there should be no time-out if you use clock stretching (or there could be some sort of watch-dog but then both sides need to be ready for certain recovery procedure to set I2C to proper initial state = all HIGH and continue with address sending/reception again).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/83561?ContentTypeID=1</link><pubDate>Thu, 09 Nov 2017 09:21:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86f75de9-2a50-4ce7-a1e5-6a7671fb721a</guid><dc:creator>Phil Young</dc:creator><description>&lt;p&gt;It appears that it is possible to run the TWI in the legacy ( deprecated ) mode on the NRF52 so it should be OK using the original NRF51 code. For some reason Nordic now appears to have 3 separate I2C interface options, 2 using EZDMA ( 1 master  and 1 slave ), and 1 like the NRF51 using interrupts, in reality they are 1 peripheral with 3 modes but Nordic could not even bother to keep them together in the datasheet so it&amp;#39;s easy to not notice this point.
As usual, the Nordic HW is good but let down by the poor documentation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/83565?ContentTypeID=1</link><pubDate>Thu, 09 Nov 2017 09:18:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5180f989-a5d1-440f-b1c6-9ebfb6d177d2</guid><dc:creator>Phil Young</dc:creator><description>&lt;p&gt;If the slave has no data available to send it sends nothing resulting in clock extension by the slave until the I2C times out and the master aborts the transaction, so this would not work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi dynamically adjust receiving length</title><link>https://devzone.nordicsemi.com/thread/83560?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 17:00:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:230cb402-8cc8-4f7f-b5c7-918958dc4455</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hi, isn&amp;#39;t TWI (I2C) read managed by slave ACK/NACK so by putting maximum buffer size (and pointer;) you will read all bytes available up to Slave&amp;#39;s NACK (or buffer overflow) and you will then read actual number of bytes read upon &lt;code&gt;NRF_DRV_TWI_EVT_DONE&lt;/code&gt; event from &lt;code&gt;nrf_drv_twi_evt_t&lt;/code&gt; structure (including data stream itself)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>