<?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 - Easy DMA</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/37606/twi---easy-dma</link><description>Hi, 
 
 I have some troubles using TWI easy DMA. I set EASY_DMA flag to 1, but I can&amp;#39;t see any results in my performance tests. Can anyone explain me the required steps? 
 
 Thanks!</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Dec 2018 17:28:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/37606/twi---easy-dma" /><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/161289?ContentTypeID=1</link><pubDate>Tue, 11 Dec 2018 17:28:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2274d4a-8006-40ba-8f85-2c7f485de353</guid><dc:creator>wpaul</dc:creator><description>&lt;p&gt;I don&amp;#39;t know offhand if nrf_fstorage_t has a pointer to the TWI register window. The nrfxxx.h header files for each chip define special types for the register overlay structures and they also have macros to define the base addresses. You should be able to do something like:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf (&amp;quot;enable register: %x\n&amp;quot;, NRF_TWI0-&amp;gt;ENABLE);&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf (&amp;quot;enable register: %x\n&amp;quot;, NRF_TWIM0-&amp;gt;ENABLE);&lt;/p&gt;
&lt;p&gt;The NRF_TWI0 handle is for using the TWI instance in programmed I/O mode. NRF_TWIM0 should be used when the instance is in EasyDMA mode. Some of the registers are the same, e.g. ENABLE, so you&amp;#39;ll get the same result regardless of which you choose, but many others are different, so for actual operation you need to use the right handle depending on the mode.&lt;/p&gt;
&lt;p&gt;But yes, if you get back 6, that means the TWI instance is set for EasyDMA master mode.&lt;/p&gt;
&lt;p&gt;As for measuring performance, be aware that the two major advantages to using EasyDMA are: 1) You can transmit a block of data at a once instead having to read/write a byte at a time, and 2) while the DMA engine is busy moving the data, the CPU can go off and do other things (i.e. parallelization). TWI/I2C isn&amp;#39;t a very high speed interface, so it&amp;#39;s possible that you can actually get reasonably good data transfer speed in either mode. So unless you measure very carefully you might not notice much difference. With programmed I/O you may see a little worse performance due to pauses between transmissions of individual bytes (this may be mitigated somewhat if the interface is designed with a FIFO). But using EasyDMA drastically reduces CPU usage.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/161172?ContentTypeID=1</link><pubDate>Tue, 11 Dec 2018 11:30:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bb99583-1159-4f51-8e7e-a0ef56b38897</guid><dc:creator>Roei</dc:creator><description>&lt;p&gt;Hi wpaul,&lt;/p&gt;
&lt;p&gt;Did you mean to read ENABLE register through nrf_fstorage_t?&lt;/p&gt;
&lt;p&gt;I did it, and I saw the value 6.&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; Does it mean that I&amp;#39;m using Easy DMA for sure?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/161083?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 21:34:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8f2b51b-bbf8-4171-9cd2-4d20d4b1bc61</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;Try to hookup a logic analyser and compare signal from both modes to see if there are any differences in the timing. &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/161075?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 18:09:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:960b238c-5bc6-4ee0-8e26-7e2e75a004ec</guid><dc:creator>wpaul</dc:creator><description>&lt;p&gt;In the nRF52 design, you have a set number of instances of various peripherals (SPI. TWI, UART, etc...) Each instance has a memory-mapped block of registers. Note however that there are a couple of possible overlaps:&lt;/p&gt;
&lt;p&gt;- Different types of peripheral blocks can share the same instance -- for example, the register block at 0x40003000 can be configured to be either SPI or TWI.&lt;/p&gt;
&lt;p&gt;- The same instance can be used for the same kind of peripheral but in either EasyDMA mode or programmed I/O mode.&lt;/p&gt;
&lt;p&gt;How do you choose which mode is in use? It depends on the value written to the ENABLE register, which is typically at offset 0x500 within a given instance&amp;#39;s register block.&lt;/p&gt;
&lt;p&gt;For example, look at the Product Specification document for the nRF52840. Section &amp;quot;4.2.4 Instantiation&amp;quot; gives you an overview of all the peripheral blocks. You&amp;#39;ll notice that register block at 0x40003000 can be configured for up to 6 different modes: SPI, SPIS, SPIM, TWI, TWIS and TWIM.&lt;/p&gt;
&lt;p&gt;You can only have at most two instances of TWI configured at the same time: one at 0x40003000 and another at 0x40004000. The value written to the enable register, i.e. 0x40003500 and 0x40004500, tells you what mode it&amp;#39;s set for.&lt;/p&gt;
&lt;p&gt;How do you know the mode value? You have to look at the peripheral description for TWI, TWIS and TWIM. For example, section 6.29 describes TWI (the programmed I/O mode). You&amp;#39;ll notice that section 6.29.8.5 documents two values for the ENABLE register: 0 to disable TWI, and 5 to enable TWI.&lt;/p&gt;
&lt;p&gt;Now look at section 6.31, which is for TWIM (the EasyDMA master mode). Section 6.31.7.6 documents two values for the ENABLE register as well: 0 to disable TWIM and 6 to enable TWIM.&lt;/p&gt;
&lt;p&gt;Note the difference: 5 is for TWI mode (programmed I/O) and 6 is for TWIM (EasyDMA). For TWIS mode, the value is 9. These values also show up in the nrf52xxx.h header files included in the SDK.&lt;/p&gt;
&lt;p&gt;The meaning of many of the other registers in the block depends on which value you write. Remember: the same block is used for both modes, but the layout of the register table is different. (In TWI mode for example, the EasyDMA source address register doesn&amp;#39;t exist.)&lt;/p&gt;
&lt;p&gt;So if you want confirm if a given TWI instance is being used in programmed I/O mode or EasyDMA mode, add some code to read the value from the ENABLE register (0x40003500 for TWI0 and 0x40004500 for TWI1) and print it on the console (or else examine it using the debugger). If it says 5 then you&amp;#39;re using programmed I/O mode, and if it says 6 then you&amp;#39;re using EasyDMA mode. If it says 0, the instance is disabled. When you set the EASY_DMA flag in the example code, this controls which mechanism the example code uses to program the TWI instance, and you can detect that by checking what value is programmed into the ENABLE register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/161040?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 15:12:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c517d1f5-4a3e-4ed4-b692-f76328c3413a</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Roei,&lt;/p&gt;
&lt;p&gt;Could you please upload your project so I could test it out on my side?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;we can make this case private if you do not want to share the code on the public view.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;//cheers&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/158953?ContentTypeID=1</link><pubDate>Mon, 26 Nov 2018 07:04:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da55493c-5d6a-417f-b1e6-94006367ba33</guid><dc:creator>Roei</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t use any callback handlers.&lt;/p&gt;
&lt;p&gt;I think our first step should be indicating easy DMA activation. Maybe I didn&amp;#39;t do the right steps. I can&amp;#39;t see any difference after using easy DMA, so it&amp;#39;s strange.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/158651?ContentTypeID=1</link><pubDate>Thu, 22 Nov 2018 13:31:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dad70e25-bba6-4d5e-a955-33bd0ea7989c</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Roei,&lt;/p&gt;
&lt;p&gt;That&amp;#39;s not that too big of packets, could you test with 255 to see if you get any higher throughput.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;(btw. the nrf52840 supports 16 bit MAXCNT register, so you could send 65535 bytes in one transfer)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Anyway, the TWI has to send an address for each new transfer, including start/stop/repeated start bits which takes throughput.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Most likely it takes a few µs each time you have to update the buffer, etc. You should also make sure that you do not do anything special in the callback handler that could slow things down. (Like logging etc.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/158484?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 15:55:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44a32ba5-cdb7-42b6-a396-a8274e4b3145</guid><dc:creator>Roei</dc:creator><description>&lt;p&gt;The configured frequency is 400k. I&amp;#39;m sending packets of 35 bytes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/158418?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 13:14:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:758d7d3d-4bf4-4a38-b979-fb1be1fa864b</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Roei,&lt;/p&gt;
&lt;p&gt;What frequency have you configured the TWI bus to run at?&lt;/p&gt;
&lt;p&gt;If you are able to transfer 24 bytes every 1 ms, this corresponds to 192 kbit/s. The maximum supported frequency of the TWI peripheral is 400 kbit/s.&lt;/p&gt;
&lt;p&gt;With the handshaking on the bus and other overhead in the peripheral, this throughput might not be that far from the limit.&lt;/p&gt;
&lt;p&gt;How large packets do you send in each transfer?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/156934?ContentTypeID=1</link><pubDate>Mon, 12 Nov 2018 15:06:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c628b78-454c-4ff0-adab-2989285ccb86</guid><dc:creator>Roei</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m&amp;nbsp;&lt;span style="background-color:transparent;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;line-height:21px;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;measuring&lt;span style="color:#b00000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;"&gt; the max running time of a task which sends buffers through twi interface. It takes too long (2-3 milliseconds). I got the same results after using easy DMA. I&amp;#39;m not sure I did the right things.&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color:transparent;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;line-height:21px;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;span style="color:#b00000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;line-height:21px;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;span style="color:#b00000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;"&gt;Thanks&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color:transparent;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;line-height:21px;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;span style="color:#b00000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/156932?ContentTypeID=1</link><pubDate>Mon, 12 Nov 2018 14:58:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:755631f4-115d-42de-96c1-58cc896ca6c0</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Roei,&lt;/p&gt;
&lt;p&gt;How are you measuring performance?&lt;/p&gt;
&lt;p&gt;Also please check out &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/12193/nrf52-twi-easydma-feature" rel="noopener noreferrer" target="_blank"&gt;this thread.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/156854?ContentTypeID=1</link><pubDate>Mon, 12 Nov 2018 11:28:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d4726bb-0589-45fc-a151-84e867f77677</guid><dc:creator>Roei</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;T&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;hank you!&lt;/span&gt; I tried to work by the example, but I didn&amp;#39;t see any performance changes. Do I have a way to see if Easy DMA is now activated?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/148901?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 06:34:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8b354c2-3a82-4fa8-963d-4d59102810ac</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Roei,&lt;/p&gt;
&lt;p&gt;If you look at the &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Ftwi_sensor_example.html&amp;amp;cp=4_0_0_4_5_43" rel="noopener noreferrer" target="_blank"&gt;TWI sensor&lt;/a&gt;&amp;nbsp;example you can see that the:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// &amp;lt;q&amp;gt; TWI0_USE_EASY_DMA  - Use EasyDMA (if present)
 

#ifndef TWI0_USE_EASY_DMA
#define TWI0_USE_EASY_DMA 1
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;is set. Please use that example as reference on how you can use eDMA with TWI.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/148407?ContentTypeID=1</link><pubDate>Wed, 12 Sep 2018 12:20:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:527aca82-dff2-45ea-a6bb-4c4da34c5842</guid><dc:creator>Roei</dc:creator><description>&lt;p&gt;Hi Martin, thanks for the response!&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I went through your links, and I still have the same questions:&lt;br /&gt;I&amp;#39;m using SDK15.00, with nrfx_twim interface. Do I need to do anything else besides changing EASY_DMA flag to 1, in order to use easy DMA?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI - Easy DMA</title><link>https://devzone.nordicsemi.com/thread/145022?ContentTypeID=1</link><pubDate>Tue, 21 Aug 2018 06:22:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b973fc36-4f7a-4806-939d-d20a59686928</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Roei,&lt;/p&gt;
&lt;p&gt;I would like you to take a look at the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Fhardware_driver_twi.html&amp;amp;cp=4_0_0_2_16" target="_blank" rel="noopener noreferrer"&gt;TWI master documentation&lt;/a&gt;&amp;nbsp;and then go through &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/20926/easydma-and-twi-_app"&gt;this thread&lt;/a&gt; and the links posted on how to use TWI eDMA.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>