<?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>(nrf51822-EK) How to read twi Multiple Byte ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4396/nrf51822-ek-how-to-read-twi-multiple-byte</link><description>Hi. 
 My board : nrf51822 -Evaluation Kit ------ mma8452q
problem : read_registers(MMA8452_ADDRESS &amp;lt;&amp;lt; 1,OUT_X_MSB, 6, rawData);
source code : link text 
 main.c
-&amp;gt; readAccelData-&amp;gt; read_registers
-&amp;gt; twi_master_transfer(device_address | TWI_READ_BIT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Jan 2015 15:58:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4396/nrf51822-ek-how-to-read-twi-multiple-byte" /><item><title>RE: (nrf51822-EK) How to read twi Multiple Byte ?</title><link>https://devzone.nordicsemi.com/thread/15600?ContentTypeID=1</link><pubDate>Mon, 12 Jan 2015 15:58:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77815097-8eeb-4a19-82b7-836d5a61254b</guid><dc:creator>aworks</dc:creator><description>&lt;p&gt;I solved this problem.
Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: (nrf51822-EK) How to read twi Multiple Byte ?</title><link>https://devzone.nordicsemi.com/thread/15599?ContentTypeID=1</link><pubDate>Mon, 12 Jan 2015 13:49:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:574e215f-aed3-423f-91e6-a570597bb15d</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;The &lt;code&gt;twi_master_transfer()&lt;/code&gt; function you refer to is a part of the TWI peripheral driver and is documented here: &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/doc/7.1.0/s110/html/a00769.html#ga36e8039d4cbb4f66c0cf0cf1e3a72445"&gt;developer.nordicsemi.com/.../a00769.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here you can see that it takes an argument, &lt;em&gt;data_length&lt;/em&gt;, which specifies how many bytes that should be transferred from the &lt;em&gt;data&lt;/em&gt; array.&lt;/p&gt;
&lt;p&gt;In the &lt;code&gt;twi_master_transfer()&lt;/code&gt; function (in &lt;strong&gt;twi_sw_master.c&lt;/strong&gt;) you can see that it will not continue to clock out bytes if &lt;code&gt;twi_master_clock_byte()&lt;/code&gt; returns false. This function returns false if it does not receive an ACK bit from the slave:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Read ACK/NACK. NACK == 1, ACK == 0
transfer_succeeded &amp;amp;= !(TWI_SDA_READ());
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should have a logic analyzer in order to be able to debug the TWI bus.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>