<?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 problem. How to read data(not include ACK)?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4450/twi-problem-how-to-read-data-not-include-ack</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:57:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4450/twi-problem-how-to-read-data-not-include-ack" /><item><title>RE: Twi problem. How to read data(not include ACK)?</title><link>https://devzone.nordicsemi.com/thread/15817?ContentTypeID=1</link><pubDate>Mon, 12 Jan 2015 15:57:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90600352-7fc3-4f4f-b8bd-c81e84f910fc</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: Twi problem. How to read data(not include ACK)?</title><link>https://devzone.nordicsemi.com/thread/15816?ContentTypeID=1</link><pubDate>Mon, 12 Jan 2015 14:15:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6afe8b61-1f2f-44ef-aa71-519caaf0de17</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;If you want to transmit data to a slave that does not issue an ACK bit, you need to use the software TWI &lt;strong&gt;twi_sw_master.c&lt;/strong&gt; (since the HW TWI requires an ACK from the slave), and you need to comment out the following line in &lt;code&gt;twi_master_clock_byte()&lt;/code&gt;:&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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi problem. How to read data(not include ACK)?</title><link>https://devzone.nordicsemi.com/thread/15813?ContentTypeID=1</link><pubDate>Wed, 19 Nov 2014 13:16:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b89099e-ff94-46cf-82fb-cd04b45e783e</guid><dc:creator>Sebastian</dc:creator><description>&lt;p&gt;You may use logic analyzer and check what is actually transmitted by MMA8452 - does it output correct data or not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi problem. How to read data(not include ACK)?</title><link>https://devzone.nordicsemi.com/thread/15812?ContentTypeID=1</link><pubDate>Tue, 18 Nov 2014 14:25:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6612b372-6b2f-47b8-ad62-8754b12b36f2</guid><dc:creator>aworks</dc:creator><description>&lt;p&gt;Thank you for reply.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m download nrf51-sdk.zip(6.1.0)&lt;/p&gt;
&lt;p&gt;Download Site 6.1.0 : &lt;a href="https://www.nordicsemi.com/eng/nordic/Products/nRF51822-Evaluation-Kit/nRF51-SDK-zip/23448"&gt;Here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;SDK 6.0.1 And I&amp;#39;m trying to read data from the mma8452q.&lt;/p&gt;
&lt;p&gt;But.. Same result... Read data is uncertain data...&lt;/p&gt;
&lt;p&gt;How do i solve this problem..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi problem. How to read data(not include ACK)?</title><link>https://devzone.nordicsemi.com/thread/15811?ContentTypeID=1</link><pubDate>Sun, 16 Nov 2014 18:58:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79470bbb-84a5-4e7b-96f4-ea2b89318dae</guid><dc:creator>Sebastian</dc:creator><description>&lt;p&gt;SDK 7.0.1 you may find on &lt;a href="http://developer.nordicsemi.com"&gt;developer site&lt;/a&gt;, depending on your environment you should pick PACK version (if you are using MDK 5.12 or newer) or zip. Be aware that this SDK supports natively only new boards, but you may easily adopt it to your board or just compare i2c drivers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi problem. How to read data(not include ACK)?</title><link>https://devzone.nordicsemi.com/thread/15815?ContentTypeID=1</link><pubDate>Sun, 16 Nov 2014 16:00:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5019c704-4c3f-456c-b2f3-4ef42ae04304</guid><dc:creator>aworks</dc:creator><description>&lt;p&gt;Thank you.
But .. Where is the SDK 7.0.1 ??
I can&amp;#39;t find SDK 7.0.1 ..
How to Download SDK 7.0.1 ?
My SDK version v5.1.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi problem. How to read data(not include ACK)?</title><link>https://devzone.nordicsemi.com/thread/15814?ContentTypeID=1</link><pubDate>Fri, 14 Nov 2014 22:38:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aaa82788-865b-4f91-8456-977df1c227ec</guid><dc:creator>Sebastian</dc:creator><description>&lt;p&gt;I have very similar code to yours:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;bool acc_read_registers(uint8_t reg, uint8_t *data, uint8_t size)
{   bool result = false;

    // select first register to be read
    if(twi_master_transfer(TWI_MASTER_CONFIG_MMA7660_ADDRESS, &amp;amp;reg, 1, TWI_DONT_ISSUE_STOP))
    {
        // read bytes and finish transaction
        result = twi_master_transfer(TWI_MASTER_CONFIG_MMA7660_ADDRESS | TWI_READ_BIT, data, size, TWI_ISSUE_STOP);
    }
    
    return(result);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and it works correctly with both TWI versions (s/w that you are using and h/w that talks by means of TWI peripheral). I&amp;#39;m using SDK 7.0.1 - which one you are working with?&lt;/p&gt;
&lt;p&gt;If you think that it could be problem in TWI driver, you may always switch to its another version - just replace file twi_sw_master.c with twi_hw_master.c and from now all timings will be controlled by h/w.&lt;/p&gt;
&lt;p&gt;Not really sure what is exactly your problem - is there error reported during read or you are getting wrong data? The fragment of twi_sw_master.c file you have shown should read 8 bits only, just after this loop ACK or NACK is generated depending if that is last byte.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>