<?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>Why there is no TWI NACK for wrong Slave address</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48578/why-there-is-no-twi-nack-for-wrong-slave-address</link><description>Hello, 
 
 I am using nRF52832, SDK_15.3.0, S132 SoftDevice and Segger for flashing the image. 
 To understand TWI better, I loaded &amp;#39;twi_sensor&amp;#39; example as is on nRF52832 development kit where there is no LM75B sensor. 
 
 As per below link, if there</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Jun 2019 17:06:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48578/why-there-is-no-twi-nack-for-wrong-slave-address" /><item><title>RE: Why there is no TWI NACK for wrong Slave address</title><link>https://devzone.nordicsemi.com/thread/192784?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 17:06:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e954218-3612-4ced-b01a-3270e3db5685</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I got the root cause. I added debug print under &amp;#39;default&amp;#39; case. For wrong address I am getting&amp;nbsp;NRF_DRV_TWI_EVT_ADDRESS_NACK. But this is not printing on terminal because of &amp;quot;while (m_xfer_done == false);&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&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_RX)
            {
                data_handler(m_sample);
            }
            m_xfer_done = true;
            break;
        default:
         NRF_LOG_INFO(&amp;quot;twi_default %d&amp;quot;, p_event-&amp;gt;type);
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Vishnu Beema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why there is no TWI NACK for wrong Slave address</title><link>https://devzone.nordicsemi.com/thread/192783?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 16:56:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ccfa6f9-617a-460f-acba-51a7edd64fa8</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Error code 33281 = 0x8201 -&amp;gt;&amp;nbsp;NRF_ERROR_DRV_TWI_ERR_ANACK ( from sdk_errors.h).&lt;/p&gt;
&lt;p&gt;I am not sure why twi_sensor don&amp;#39;t throw any errors, is it using the same GPIO&amp;#39;s as twi_scanner and is there external pull ups? Having a logic analyzer (e.g.&amp;nbsp;saleae) to look at the actual twi activity may be helpful here, then it&amp;#39;s possible to decode the twi transfer.&lt;/p&gt;
&lt;p&gt;It may also be related to that twi_scanner use&amp;nbsp;nrf_drv_twi_rx() and twi_sensor use&amp;nbsp;nrf_drv_twi_tx(), though I would expect both to throw error or success.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why there is no TWI NACK for wrong Slave address</title><link>https://devzone.nordicsemi.com/thread/192782?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2019 12:49:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f637e8b2-aabc-4a67-a41d-4ad864fa9bdb</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Initially I used &amp;#39;twi_scanner&amp;#39; and got the address of the slave device. But to debug for NACK, I kept debug print for else condition.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    for (address = 1; address &amp;lt;= TWI_ADDRESSES; address++)
    {
        err_code = nrf_drv_twi_rx(&amp;amp;m_twi, address, &amp;amp;sample_data, sizeof(sample_data));
        if (err_code == NRF_SUCCESS)
        {
            detected_device = true;
            NRF_LOG_INFO(&amp;quot;TWI device detected at address 0x%x.&amp;quot;, address);
        }
        else
        {
            NRF_LOG_INFO(&amp;quot;error %d&amp;quot;, err_code);
        }
        NRF_LOG_FLUSH();
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am getting 33281. I am not sure what is this.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: error 33281
&amp;lt;info&amp;gt; app: error 33281
&amp;lt;info&amp;gt; app: TWI device detected at address 0x40.
&amp;lt;info&amp;gt; app: error 33281
&amp;lt;info&amp;gt; app: error 33281
&amp;lt;info&amp;gt; app: error 33281
&amp;lt;info&amp;gt; app: error 33281&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then to crosscheck I loaded &amp;#39;twi_sensor&amp;#39;. Since there is no device with slave address 0x90, I expected&amp;nbsp;NRF_DRV_TWI_EVT_ADDRESS_NACK or&amp;nbsp;NRF_DRV_TWI_EVT_DATA_NACK as part of twi_handler(). But none occurred.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The reason behind all these is to understand when NACK will trigger and once triggered how to handle.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Vishnu Beema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why there is no TWI NACK for wrong Slave address</title><link>https://devzone.nordicsemi.com/thread/192781?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2019 11:56:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e862753-47e5-4654-985e-75d953d5a8dc</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;My suggestion for debugging: First make sure to run the twi_scanner example (without any modifications) to identify the correct address, wrong addresses will be nacked yes. Also make sure that you have pull-up resistors on the twi pins.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>