<?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>How to read fifo data in TWI?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22423/how-to-read-fifo-data-in-twi</link><description>Hello. 
 I use nRF52 &amp;amp; mpu9250.
I want to use dmp.
But now it&amp;#39;s not going well. 
 Now, there is no error,but fifo_count doesn&amp;#39;t change after fifo_count became 512.
I think fifo_count should reset after finished reading fifo data.
DMP is enable.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 07 Jun 2017 13:18:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22423/how-to-read-fifo-data-in-twi" /><item><title>RE: How to read fifo data in TWI?</title><link>https://devzone.nordicsemi.com/thread/88175?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2017 13:18:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:038a926a-e979-40d1-9fca-c09c60937c6d</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Yes, I think so. This is what I mean in pseudocode:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;for(as many bytes as you want to read from fifo buffer)
{
    // nrf_drv_twi_tx(&amp;amp;m_twi_instance, MPU_ADDRESS, FIFO_REGISTER_VALUE, 1, false);
    // nrf_drv_twi_rx(&amp;amp;m_twi_instance, MPU_ADDRESS, ONE BYTE LONG BUFFER, 1);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;My theory is that you have to do a write transfer to tell the MPU that you want to read one more byte from the FIFO buffer for every byte you want to read.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read fifo data in TWI?</title><link>https://devzone.nordicsemi.com/thread/88174?ContentTypeID=1</link><pubDate>Mon, 05 Jun 2017 10:44:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0a9d5e4-9ad9-4f55-b5df-ddcb29654596</guid><dc:creator>Sagisawa Yukichi</dc:creator><description>&lt;p&gt;I used mpu9250_read_fifo_register(st-&amp;gt;hw-&amp;gt;addr, st-&amp;gt;reg-&amp;gt;fifo_r_w, length, data).
length = 22.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;However, if you do it this way I believe you increment the register number your are reading from on every read operation. You have to tell the MPU to read from the same address every time. Otherwise you will read a bunch of sequential registers, which I don&amp;#39;t think is what you want to do.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;you mean my code has mistake?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read fifo data in TWI?</title><link>https://devzone.nordicsemi.com/thread/88173?ContentTypeID=1</link><pubDate>Fri, 02 Jun 2017 14:56:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:372bf1a2-33a4-4a1e-9a25-f0716684afd4</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I haven&amp;#39;t used the FIFO in the MPU, so I&amp;#39;m not sure how it works. The way I understand it though, is that you are supposed to read the entire buffer out of the &amp;quot;FIFO Read/Write&amp;quot; register (0x74). So after reading one byte, a new byte from the FIFO is latched into the FIFO Read/Write, and so on, until you have read out all the data. In your mpu9250_read_fifo_register() function however, it looks like you start reading at a certain address (I can only assume it is correct since it doesn&amp;#39;t say in your code) and then you continue reading one by one byte in a for() loop. However, if you do it this way I believe you increment the register number your are reading from on every read operation. You have to tell the MPU to read from the same address every time. Otherwise you will read a bunch of sequential registers, which I don&amp;#39;t think is what you want to do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read fifo data in TWI?</title><link>https://devzone.nordicsemi.com/thread/88172?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 05:21:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b39b9105-f5d4-4e13-9971-b2124f576911</guid><dc:creator>Sagisawa Yukichi</dc:creator><description>&lt;p&gt;Thanks your comment.&lt;/p&gt;
&lt;p&gt;I added code of reading fifo and problem.&lt;/p&gt;
&lt;p&gt;Now, there is no error,but fifo_count doesn&amp;#39;t change after fifo_count became 512.
I think fifo_count should reset after finished reading fifo data.
DMP is enable. It checks code of reading fifo_stream.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read fifo data in TWI?</title><link>https://devzone.nordicsemi.com/thread/88171?ContentTypeID=1</link><pubDate>Wed, 31 May 2017 15:22:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f09a12c-5fe9-4068-8ce1-2d5896218ce9</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can you elaborate a bit around what is not going well?&lt;/li&gt;
&lt;li&gt;Do you get errors?&lt;/li&gt;
&lt;li&gt;Are you able to read anything at all?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&amp;#39;m not familiar with the DMP in the MPU9250, but as far as I know you have to enable it? At least it is slightly more complicated than simply using the accelerometer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>