<?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_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30169/nrf_twi_mngr_perform-blocking</link><description>I&amp;#39;ve been using the nrf_twi_mngr_perform() function assuming that my transaction was complete when the function returned. Because of this, I felt safe keeping my descriptors on the stack. However, it appears to me that if there are other transactions</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Mar 2018 09:52:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30169/nrf_twi_mngr_perform-blocking" /><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/123590?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 09:52:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:119180f0-8935-4c9e-9ec9-787ffb9d9d5c</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;Unrelated to the&amp;nbsp;bug we are working on I just wanted to mention this project made by a Nordic engineer which may be of interest to you:&amp;nbsp;&lt;a href="https://github.com/Martinsbl/nrf5-mpu-examples"&gt;https://github.com/Martinsbl/nrf5-mpu-examples&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/123539?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 04:33:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e47e3b3-376c-4501-8b63-6ed201b82489</guid><dc:creator>Jason Hendrix</dc:creator><description>&lt;p&gt;Thanks for that Rune.&amp;nbsp; A timeout of 5 is equal to 2.5 ms, which is enough time for 100 bytes on the I2C running at 400KHz (if I&amp;#39;m not mistaken).&amp;nbsp; That seems like plenty of time to complete a single byte read (of course there&amp;#39;s a couple of bytes of overhead and the slave can delay the return value but I haven&amp;#39;t seen anything on the order of a millisecond...)&lt;/p&gt;
&lt;p&gt;That said, I agree that I can&amp;#39;t trigger the fault with a longer delay.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;d like to look at this some more because I&amp;#39;m fairly certain that I had this problem without hitting my timeout function in my application code.&amp;nbsp; I&amp;#39;ll get back to you in a few days.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/123492?ContentTypeID=1</link><pubDate>Thu, 08 Mar 2018 16:13:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d08c24de-51f2-4fcb-9e9c-79f314d77cb3</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for your patience. I was able to borrow a sensor from a colleague&amp;nbsp;who happened to have one (not quite the same model, but it responded to the TWI commands so close enough). With that, I was able to reproduce the issue and debug it. Below you can see a screenshot of the crashed state where the device hardfaulted shortly after attempting to schedule a TWI operation.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1040x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-62bcb3db1966417196050cb5701e0c0e/debugger-screenshot-from-ses.png" /&gt;&lt;/p&gt;
&lt;p&gt;I did some further digging, and it seems the device has a timeout of only 5 set two places in the variable&amp;nbsp;&amp;quot;TWITimeout&amp;quot;. When this timeout is hit the device is not able to recover correctly. Simply setting this timeout to 50 instead of 5 seems to have resolved the issue for me. I don&amp;#39;t see a reason it needs to be as low as 5, so you can try to experiment with this value to find the lowest stable value.&lt;/p&gt;
&lt;p&gt;(A note, I would recommend putting this number in a define rather than having a number hardcoded in two places)&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/123128?ContentTypeID=1</link><pubDate>Tue, 06 Mar 2018 16:37:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:295bf828-75a6-4435-a47c-42a27244d2d7</guid><dc:creator>Jason Hendrix</dc:creator><description>&lt;p&gt;Hi Rune,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; You should be able to see the issue with any I2C target.&amp;nbsp; The readme has some notes on porting.&amp;nbsp; If you&amp;#39;re co-located with Kenneth, he is working on another issue (probably related) and has this MPU part on order.&amp;nbsp; Perhaps you can share:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/30132/i2c-reads-stuck"&gt;devzone.nordicsemi.com/.../i2c-reads-stuck&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/123058?ContentTypeID=1</link><pubDate>Tue, 06 Mar 2018 12:23:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93aaef5b-c39a-4114-94a1-c373039bdaa9</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry for the delay, have you figured this issue out in the meanwhile? Let me know if you have any further details and still need help with this.&lt;/p&gt;
&lt;p&gt;I had a look at your project, and I can&amp;#39;t spot any cause of the issue from looking at the source code. Unfortunately, I do not have an MPU6050 available so I am unable to actually run and debug your project on actual hardware. I had a peek at some projects using motion control with our chip and found that the&amp;nbsp;MPU-9250 has at least been used successfully. It looks similar enough that I assume the MPU6050 shouldn&amp;#39;t be an issue if you can find the bug in your firmware.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/121526?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 13:55:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d62450f-d57e-49f2-9d06-094fe2e431af</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;Thank you. I have been talking a bit with the SDK team regarding this, and I&amp;#39;ll look into the project you sent me and follow it up with the SDK team. Hopefully, we will figure out what is the issue here. It may be a few days.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/121466?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 06:35:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec8894c3-7964-4f83-99b0-f78fdba4b29d</guid><dc:creator>Jason Hendrix</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Rune,&amp;nbsp; I&amp;#39;m uploading a project that can be used to recreate the issue.&amp;nbsp; The README provides more details.&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Debug_5F00_Test.zip"&gt;devzone.nordicsemi.com/.../Debug_5F00_Test.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/120911?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2018 23:40:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0b72172-1970-49f3-80d6-bf0115f8ae6d</guid><dc:creator>Jason Hendrix</dc:creator><description>&lt;p&gt;HI Rune,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; I&amp;#39;ve been delayed slightly - will get back to this in about a week.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/120340?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2018 17:54:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fa1b076-ffa7-4f07-972f-e5e4c7ec1d98</guid><dc:creator>Jason Hendrix</dc:creator><description>&lt;p&gt;HI Rune,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;Here are a couple of pictures of the fault in action.&amp;nbsp; I&amp;#39;ll try to pin it down better, but from the pictures you can see that we had a TWIM interrupt and are scheduling the next transaction.&amp;nbsp; However, the next (current) transaction points to a read descriptor on the stack, which is corrupted, as you can see by the TWI cfg.&amp;nbsp; I believe a couple of weeks ago I was able to catch a &amp;quot;blocking&amp;quot; twi_perform that actually completed a different transaction when it returned.&amp;nbsp; That&amp;#39;s why it seems to me that the perform waited on a transaction that was already in the queue, leaving the transaction I wanted to wait on (and which had descriptors on the stack) in the queue.&amp;nbsp; Then when this interrupt occurs, and the descriptor gets pulled from the queue, my blocking register read function has already gone out of scope.&amp;nbsp; &amp;nbsp;That&amp;#39;s all just my hypothesis.&amp;nbsp; I&amp;#39;ll try to get some more concrete evidence, or something more repeatable.&amp;nbsp; I&amp;#39;m also working on &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/30132/i2c-reads-stuck"&gt;this issue&lt;/a&gt;&amp;nbsp;and can probably use that test setup for both issues.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1518112420201v1.png" alt=" " /&gt;&amp;nbsp; &amp;nbsp;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1518112436490v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_twi_mngr_perform blocking</title><link>https://devzone.nordicsemi.com/thread/120318?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2018 15:30:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4d67e6a-47ce-4b2c-9427-eb134b8f11ec</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;I am not 100% sure I understand what your problem is, the description of what you are doing seems like a correct way queue and perform blocking and non-blocking TWI operations. Let me know if I misunderstood you.&lt;/p&gt;
&lt;p&gt;It is perfectly fine to mix &amp;quot;schedule&amp;quot; and &amp;quot;perform&amp;quot; calls to the nrf_twi_mngr. Schedule calls will not block but return immediately. Scheduled operations will be performed when the bus is available. Perform calls can queue one or more operations and will block until the operation is done. Perform calls should not return early, so you shouldn&amp;#39;t be able to end up out of scope.&lt;/p&gt;
&lt;p&gt;Take care to check all return values from these API calls. Error codes have to be handled, or you may experience packets never being sent.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>