<?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 Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83930/twi-manager---twi-delayed-after-start-condition</link><description>Hello, 
 I&amp;#39;ve used the TWI manager to implemented a burst of transfers to and from two devices on a single bus. Basically it waits for both devices to give a data-ready interrupt via GPIOTE, and then it schedules that block of transactions (36 in total</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Feb 2022 15:31:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83930/twi-manager---twi-delayed-after-start-condition" /><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/353906?ContentTypeID=1</link><pubDate>Fri, 18 Feb 2022 15:31:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e23a7846-b5f4-4bcb-9ce4-14e19fa42844</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi Dylan,&lt;/p&gt;
&lt;p&gt;I would also not expect a reduction in priority to affect this, but I also would not expect any delay before the address is output at all.&lt;/p&gt;
&lt;p&gt;If you could find a way to help us reproduce this behavior on a DK, we could look further into it, but otherwise I think it will be hard to debug further.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Alternatively, if you can confirm that this happens with any/no I2C slave device connected to the bus, and can provide your code, we can try to reproduce it on our DK ourselves.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/351406?ContentTypeID=1</link><pubDate>Fri, 04 Feb 2022 19:55:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9242a90c-eb03-4ecb-96aa-8ac3bd5cae7d</guid><dc:creator>underpickled</dc:creator><description>&lt;p&gt;Hi J&amp;oslash;rgen,&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t say for sure if this alone solved it, but I fixed another issue related to the TWI interrupt priority interfering with the softdevice interrupt priority. Basically I had to reduce the TWI interrupt priority from HIGH to LOW_MID to get BLE streaming working, and since then I&amp;#39;ve looked back at the traces and they are much more stable. There is occasionally a 90-120 us gap, but that&amp;#39;s much more tolerable than 2-4 ms and no longer concerning at all. Do you think that could have addressed the issue somehow? I wouldn&amp;#39;t expect a priority reduction to *reduce* delays, but maybe you have some insight into that.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Dylan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/350530?ContentTypeID=1</link><pubDate>Mon, 31 Jan 2022 20:35:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13a367c9-8ef9-480b-bd47-8f5a33e2bd53</guid><dc:creator>underpickled</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, both buses have two of the same slave devices (total of 4, they only have I2C interfaces and only two available addresses each, hence the two bus implementation). I haven&amp;#39;t tried reproducing this on a DVK (I&amp;#39;m not sure I have the hardware available to replicate the exact setup). It&amp;#39;ll be tricky, but I can try to cut the clock trace and solder a resistor in-line.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Dylan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/350510?ContentTypeID=1</link><pubDate>Mon, 31 Jan 2022 17:27:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:446b27ad-971b-4db1-8909-452059503b69</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you interfacing the same slave TWI device on the bus on the second board that is failing? Have you been able to reproduce this behavior on one of our DKs?&lt;/p&gt;
&lt;p&gt;One of my colleagues suggested to connect a small resistor on&amp;nbsp;the clock pin, to measure analog channels before and after the resistor to find if it&amp;#39;s the slave or master that is holding the clock low here. Would you be able to measure that?&lt;/p&gt;
&lt;p&gt;P0.11 should noe have any special features that could affect the TWI peripheral as far as I can see.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/350098?ContentTypeID=1</link><pubDate>Fri, 28 Jan 2022 02:16:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f71d167-a87d-4b45-b82c-6eb7fc0e37a3</guid><dc:creator>underpickled</dc:creator><description>&lt;p&gt;I&amp;#39;ve got another interesting example of this here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/TWI0_5F00_1_5F00_delays.sal.zip"&gt;devzone.nordicsemi.com/.../TWI0_5F00_1_5F00_delays.sal.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is running basically the same code, but on a different board with two TWI buses used. I have two TWI manager instances. On this board, the delay only seems to pop up in TWI1 (SCL: P0.11, SDA: P1.9) and does not appear in TWI0 (SCL: P0.5, SDA: P0.4). I also notice the periodicity is different.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know if this could be related, but pin 0.11 is the SDA line in the original ticket.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/349629?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 17:32:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ae1108b-7c35-41fb-a7f4-1a6d7ec1c301</guid><dc:creator>underpickled</dc:creator><description>&lt;p&gt;I&amp;#39;ll give that a try and report back. In the meantime, here&amp;#39;s the zipped logic trace.&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf52_5F00_TWI_5F00_delay_5F00_after_5F00_SC.sal.zip"&gt;devzone.nordicsemi.com/.../nrf52_5F00_TWI_5F00_delay_5F00_after_5F00_SC.sal.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Just to clarify the static placements, do you mean the transfer buffers, the queue, every definition related to TWI, or just a subset of those?&lt;/p&gt;
&lt;p&gt;[Update]: As I&amp;#39;m looking into this, while the RAM/Memory map tells me which addresses belong to each AHB slave RAM region, I can&amp;#39;t find anything indicating which peripherals are using which AHB slave. I can&amp;#39;t tell if it&amp;#39;s safer to put everything in RAM0 or RAM8. Also, what is the preferred method of specifying an address for static allocations? I tried using the syntax in the EasyDMA example (static foo[n]&amp;nbsp; __at__ 0xADDR), but it would not compile.&lt;/p&gt;
&lt;p&gt;[Update 2]: I was able to move the array of transfers as well as the other data used to support it into a section in AHB RAM8 (0x20018000, previously they were being mapped in the 0x20002--- range or so). The behavior is the same. I also notice that this glitch appears to be periodic, happening reliably every ~1100ms.&lt;/p&gt;
&lt;p&gt;[Update 3]: I have also tried disabling BLE advertising, as well as not initializing BLE to begin with, but it appears to still be happening.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Dylan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/349574?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 14:21:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2363ebc-6723-4d74-9b86-7e4041ac6257</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The only thing that comes to mind would be that a &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/ahbmultilayer.html"&gt;higher priority AHB master&lt;/a&gt; accesses the same RAM block/AHB slave and blocks the TWIM peripheral. Just to rule this out, can you test to statically place all TWIM buffers in a RAM section not used by any other peripherals or the CPU, and see if the issue still persists? See&amp;nbsp;&lt;a title="RAM - Random access memory" href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/memory.html#ram"&gt;Random access memory&lt;/a&gt;&amp;nbsp;for details about which RAM addresses/sections are mapped to which AHB slave.&lt;/p&gt;
&lt;p&gt;Looks like the CSV file can&amp;#39;t be imported in Saleae Logic. Can you try to zip the logic trace file and upload that? I belive the site should accept .zip files.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/349363?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 17:50:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab5d1f1a-cfc4-4cf4-a5d5-6f5c13fc309a</guid><dc:creator>underpickled</dc:creator><description>&lt;p&gt;Hi J&amp;oslash;rgen,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using SDK 17.1 and Easy DMA is enabled in sdk_config.h (though each transfer loaded into the queue has its own static pointers to the data to send and received). Is it possible the softdevice is causing this interruption? I know that&amp;#39;s theoretically possible, but it seems odd that it would cause an initiated TWI transfer to stall.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using pins 0.11 (SDA) and 0.12 (SCL). I could try different pins, but it would result in some fly-wires that might degrade performance.&lt;/p&gt;
&lt;p&gt;Regarding clock stretching, I don&amp;#39;t have other devices to immediately test with this board, but as you mentioned it happens before the address (I find this is always the case), which seems to rule out the slave stretching the clock. The slave devices are TI FDC2214, for the record. I generally expect predicable behavior from TI chips.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m attempting to attach the full Saleae trace file, but this isn&amp;#39;t letting me upload it in this comment. I&amp;#39;ll see if I can add it to the original post.&lt;/p&gt;
&lt;p&gt;[Edit]: It appears to only let me upload a CSV. The trace file is much smaller and probably easier to work with, but it won&amp;#39;t allow me to upload it. Let me know if I can send it over somehow.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/digital.csv"&gt;devzone.nordicsemi.com/.../digital.csv&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Channels 0 and 1 are SCL and SDA, respectively. Channels 2 and 3 are the interrupts that trigger the burst transfer.&lt;/p&gt;
&lt;p&gt;Thanks for your help,&lt;/p&gt;
&lt;p&gt;Dylan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager - TWI delayed after start condition</title><link>https://devzone.nordicsemi.com/thread/349353?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 16:48:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07b1d138-c6d9-4c2f-86e2-fc9059949cff</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Which SDK version are you using?&lt;/p&gt;
&lt;p&gt;Is the TWI instance configured to use EasyDMA? This is configured through the following configs in your sdk_config.h file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// &amp;lt;q&amp;gt; TWI0_USE_EASY_DMA  - Use EasyDMA (if present)
#ifndef TWI0_USE_EASY_DMA
#define TWI0_USE_EASY_DMA 0
#endif


// &amp;lt;q&amp;gt; TWI1_USE_EASY_DMA  - Use EasyDMA (if present)
#ifndef TWI1_USE_EASY_DMA
#define TWI1_USE_EASY_DMA 0
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;TWI will be more affected by other interrupts in your application, as you need to update the data pointer for each byte being sent/received. However, according to the transfer diagrams, both TWI and TWIM should send the address and send/receive at least one byte before there is any pause in transmission (&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/twi.html#concept_unj_wlw_sr"&gt;TWI&lt;/a&gt;/&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/twim.html#concept_bg4_swp_xr"&gt;TWIM&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Which GPIOs are you using for SCL/SDA? Have you tried different pins?&lt;/p&gt;
&lt;p&gt;Are you seeing this behavior with other TWI/I2C slaves, or could it be the slave doing some clock stretching, etc? Would be a bit strange if this happens before the address is written to the bus.&lt;/p&gt;
&lt;p&gt;Can you share the full logic trace file that shows this happening?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>