<?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 master does not send NACK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59014/twi-master-does-not-send-nack</link><description>For some reason it seems that the TWI master does not generate a NACK. As a consequence, the TWI slave keeps sending data. I have managed to create a very simple function that should generate a NACK: 
 
 
 
 The function should generate a NACK is the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Mar 2020 14:36:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59014/twi-master-does-not-send-nack" /><item><title>RE: TWI master does not send NACK</title><link>https://devzone.nordicsemi.com/thread/239568?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 14:36:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf04d7b3-6fe9-4dda-9445-6d2b012ffbb2</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;I have actually found the problem after several hours of debugging. The problem was related to line 20:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_TWI1-&amp;gt;TASKS_STOP;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The line should be as follows:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_TWI1-&amp;gt;TASKS_STOP = 1;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then the master generates a NACK before a stop condition.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For some reason, SES does not generate any kind of warning about an empty statement. As a consequence, it took some time before I finally found the root cause of the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI master does not send NACK</title><link>https://devzone.nordicsemi.com/thread/239566?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 14:33:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1f5b514-bf9a-44b0-ba3a-8ed50af03c74</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;Hi, I am using the TWI at the register level. If parameter ack is zero, the master initiates a stop condition. However, according to the product specification, the master also sends a NACK if a stop condition has been initiated before the byte has been read.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI master does not send NACK</title><link>https://devzone.nordicsemi.com/thread/239551?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 13:53:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e83dd867-499d-4035-9274-00f10f3301a6</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see how ack parameter could affect master response. NACK will be sent only for the last received byte, so you have to set MAXCNT=1 to force NACK after first byte. STOP task is not related to ACK/NACK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>