<?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>ACK/NACK in NUS sample code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/121039/ack-nack-in-nus-sample-code</link><description>Hi, 
 Does Central or Peripheral UART enable ACK/NACK in the code for BLE communication? How does Peripheral recognize if Central has received all the data ? Is there any ACK for the same ? Regards Thank you Pallavi</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Apr 2025 22:19:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/121039/ack-nack-in-nus-sample-code" /><item><title>RE: ACK/NACK in NUS sample code</title><link>https://devzone.nordicsemi.com/thread/533645?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2025 22:19:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0e89e07-b499-4a1d-944c-7c7215bebda9</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi pal_722,&lt;/p&gt;
[quote user="pal_722"]Where can we find this in the code?[/quote]
&lt;p&gt;The Link Layer is implemented in the Bluetooth Controller. The default controller in the nRF Connect SDK (NCS) is the SoftDevice Controller, which is only released as a binary,&amp;nbsp;and you don&amp;#39;t have access to the source code.&lt;/p&gt;
&lt;p&gt;However, this acknowledging mechanism is specified in the Bluetooth Core Specification. Therefore, the fact that the SoftDevice Controller is qualified by the Bluetooth SIG is a guarantee that the Link Layer works to spec, including the acknowledging mechanism.&lt;/p&gt;
[quote user="pal_722"]I have read that Notify characteristic doesn&amp;#39;t give ACK/NACK, is it TRUE?&lt;br /&gt;If so, what should I do to reduce data loss?&amp;nbsp;&lt;br /&gt;Should I change to Notify to Indications?[/quote]
&lt;p&gt;As Simon said, there are multiple layers in the Bluetooth LE protocol.&lt;/p&gt;
&lt;p&gt;When we talk about Notification and Indication, we are talking about the GATT layer. In this layer, it is true that Notifications don&amp;#39;t have acknowledge, while Indications do.&lt;/p&gt;
&lt;p&gt;However, all&amp;nbsp;traffic in the GATT layer will eventually go through the Link Layer, where every packet does have acknowledgement.&lt;/p&gt;
&lt;p&gt;Adding the fact that the BLE stack is guaranteed to pass every event to the application, notifications can be&amp;nbsp;used without data losses. The application simply&amp;nbsp;needs to have enough buffer to store the data and process the data fast enough.&lt;/p&gt;
&lt;p&gt;Indication is useful in scenarios where processing can&amp;#39;t be quick enough. The acknowledgement can be used as a form of flow control. You can refer to this DevZone case for a discussion on the topic:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/44482/use-cases-of-indications---when-is-it-better-to-use-indications-over-notifications"&gt;Use cases of indications - When is it better to use indications over notifications?&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ACK/NACK in NUS sample code</title><link>https://devzone.nordicsemi.com/thread/533342?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2025 09:17:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:969b2883-69bd-4041-97f3-a2e5b06fdcb0</guid><dc:creator>pal_722</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/simonr"&gt;Simonr&lt;/a&gt;&amp;nbsp;&lt;br /&gt;Thank you for the reply. I have understood the concept.&lt;/p&gt;
&lt;p&gt;Where can we find this in the code?&lt;/p&gt;
&lt;p&gt;I have read that Notify characteristic doesn&amp;#39;t give ACK/NACK, is it TRUE?&lt;br /&gt;If so, what should I do to reduce data loss?&amp;nbsp;&lt;br /&gt;Should I change to Notify to Indications?&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;Thank you&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ACK/NACK in NUS sample code</title><link>https://devzone.nordicsemi.com/thread/533326?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2025 08:48:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ffef996-481f-432a-8e2c-28fd1a075056</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The UART itself doesn&amp;#39;t do ACK/NACK, and this happens in the Bluetooth LE Link Layer. The l&lt;span&gt;ink layer uses 2 bits for acknowledgement: transmitSeqNum and nextExpectedSeqNum called SN and NESN bits from the packet&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When receiving a packet, the device compares the packet&amp;#39;s NESN with its own sn&lt;/li&gt;
&lt;li&gt;If they match, it&amp;#39;s considered a NACK (negative acknowledgment)&lt;/li&gt;
&lt;li&gt;If they don&amp;#39;t match, it&amp;#39;s considered an ACK (acknowledgment)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>