<?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>No NAK reported with TWI driver?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14585/no-nak-reported-with-twi-driver</link><description>Using nRF5 SDK v11.0.0, I am working on bringing up new hardware based on the nRF52. I started with code that works on the PCA10040 development board in which we connected an FTDI USB-to-I2C chip. When switching to our new hardware board, we found that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 20 Jun 2016 22:37:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14585/no-nak-reported-with-twi-driver" /><item><title>RE: No NAK reported with TWI driver?</title><link>https://devzone.nordicsemi.com/thread/55679?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2016 22:37:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e82aa2a-ce3a-4f79-80af-ec310560b7e7</guid><dc:creator>David Russell</dc:creator><description>&lt;p&gt;It turns out the FTDI datasheet from which I was comparing the waveform had an error.  The ACK bit I was looking at was supposed to be a NAK coming from the master indicating the end of the transfer.  The datasheet showed the slave device outputting an ACK after it wrote its own data byte which is incorrect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No NAK reported with TWI driver?</title><link>https://devzone.nordicsemi.com/thread/55681?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2016 18:05:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:148c601a-efd4-45ae-abc2-b6bc87fbec9f</guid><dc:creator>David Russell</dc:creator><description>&lt;p&gt;I was using the driver in blocking mode.  That said, I tried adding an event handler; but I received the same result -- the event handler callback said that the byte was read when the slave device was actually nacking the transaction.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No NAK reported with TWI driver?</title><link>https://devzone.nordicsemi.com/thread/55680?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2016 06:15:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e63bb6bc-10f9-4cf5-898e-6a195699ec59</guid><dc:creator>Quinn</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think you should wait a event is done before reading and writing next command.
Setup event as below&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;....
err_code = nrf_drv_twi_init(&amp;amp;m_twi_handle, &amp;amp;nrf_drv_twi_config, twi_handler, NULL);
APP_ERROR_CHECK(err_code);
....
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;// handler function&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void twi_handler(nrf_drv_twi_evt_t const * p_event, void * p_context)
{
	switch(p_event-&amp;gt;type)
    {
        case NRF_DRV_TWI_EVT_DONE:
            if (p_event-&amp;gt;xfer_desc.type == NRF_DRV_TWI_XFER_TX)
            {
                m_tx_done = true;
            }
            else if (p_event-&amp;gt;xfer_desc.type == NRF_DRV_TWI_XFER_RX)
            {
                m_rx_done = true;
            }
            else{
            	NRF_LOG_PRINTF(NRF_LOG_COLOR_RED &amp;quot;Don&amp;#39;t have event type\n&amp;quot;);
            }
            break;
        case NRF_DRV_TWI_EVT_ADDRESS_NACK:
        	NRF_LOG_PRINTF(NRF_LOG_COLOR_RED &amp;quot;TWI NRF_DRV_TWI_EVT_ADDRESS_NACK\n&amp;quot;);
        	break;
        case NRF_DRV_TWI_EVT_DATA_NACK:
        	NRF_LOG_PRINTF(NRF_LOG_COLOR_RED &amp;quot;TWI NRF_DRV_TWI_EVT_DATA_NACK\n&amp;quot;);
            break;
        default:
            break;
    }

}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Good luck!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>