<?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>Architecture of Bluetooth Peripheral Sample</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112346/architecture-of-bluetooth-peripheral-sample</link><description>Hello guys, 
 
 I&amp;#39;m trying to clearly understand the Bluetooth Peripheral Sample github.com/.../peripheral_uart and how it exactly works.. so i&amp;#39;m curious if there are some software diagrams or architectures that describes this code ? and also i&amp;#39;m curious</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Jun 2024 14:10:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112346/architecture-of-bluetooth-peripheral-sample" /><item><title>RE: Architecture of Bluetooth Peripheral Sample</title><link>https://devzone.nordicsemi.com/thread/490912?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2024 14:10:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13f7a8cd-acc7-48c7-8d0e-695927c64799</guid><dc:creator>Ih3b</dc:creator><description>&lt;p&gt;Thank you, it&amp;#39;s clear.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Architecture of Bluetooth Peripheral Sample</title><link>https://devzone.nordicsemi.com/thread/490809?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2024 09:04:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77f02ba2-436d-4c53-8416-e523cb3419e8</guid><dc:creator>Priyanka</dc:creator><description>&lt;div&gt;This is an expected behaviour, and is part of the UART asynchronous API&amp;#39;s functionality. When you call&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;uart_rx_buf_rsp(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data));&lt;/code&gt;, you&amp;#39;re providing a second buffer for the UART driver to use, once the first buffer is filled.&lt;/div&gt;
&lt;div&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;UART_RX_BUF_RELEASED&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;event is generated when the current buffer is no longer used by the driver. This event can occur multiple times for the same buffer, depending on the implementation. The buffer may be released when it is completely or partially filled.&lt;/div&gt;
&lt;div&gt;In your logs, the first&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;UART_RX_BUF_RELEASED&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;event is triggered when the first buffer (buf=0x2000b180) is filled and no longer used by the driver. The second&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;UART_RX_BUF_RELEASED&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;event is triggered when the second buffer (buf=0x2000b198) is no longer used by the driver. The second buffer is empty (len=0), which is why it&amp;#39;s released immediately. Hope this clears your doubt.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Regards,&lt;/div&gt;
&lt;div&gt;Priyanka&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Architecture of Bluetooth Peripheral Sample</title><link>https://devzone.nordicsemi.com/thread/490664?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2024 13:22:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7487bae9-d1fe-4969-b8b2-b16a29bb4d40</guid><dc:creator>Ih3b</dc:creator><description>&lt;p&gt;Thank you so much.&lt;/p&gt;
&lt;p&gt;I have discouvred a weird behaviour of the UART Driver which consists of calling UART_RX_BUF_RELEASED two times ( i think it&amp;#39;s because of using uart_rx_buf_rsp(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data)); ), so is it something normal ? as UART_RX_BUF_REQUEST creates a new empty buffer, if my current buffer (filled) is released and the second buffer is provided but is empty directly it calls UART_RX_BUF_RELEASED ? because in the documentation i did not see in any case the UART_RX_BUF_RELEASED&amp;nbsp; could happen twice. Some logs i took : &lt;/p&gt;
&lt;p&gt;[00:00:42.523,590] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: UART_RX_RDY&lt;br /&gt;[00:00:42.529,663] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: UART_RX_BUF_RELEASED //first call &lt;br /&gt;[00:00:42.529,663] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: UART_RX_BUF_RELEASED: buf=0x2000b180 len=2&lt;br /&gt;[00:00:42.529,693] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: Buffer added to FIFO: buf=0x2000b180&lt;br /&gt;[00:00:42.529,724] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: UART_RX_BUF_RELEASED //second call&lt;br /&gt;[00:00:42.529,724] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: UART_RX_BUF_RELEASED: buf=0x2000b198 len=0&lt;br /&gt;[00:00:42.529,754] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: Buffer freed: buf=0x2000b198&lt;br /&gt;[00:00:42.529,754] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: UART_RX_DISABLED&lt;br /&gt;[00:00:42.529,785] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: UART_RX_BUF_REQUEST&lt;br /&gt;[00:00:42.529,815] &amp;lt;dbg&amp;gt; peripheral_uart: uart_cb: Buffer response with new buffer: buf=0x2000b198&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Architecture of Bluetooth Peripheral Sample</title><link>https://devzone.nordicsemi.com/thread/490261?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2024 11:51:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3b18b59-693c-4576-add6-a5d260ae6169</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;div&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;k_work_init_delayable(&amp;amp;uart_work, uart_work_handler);&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is a function call in Zephyr&amp;nbsp; which is used to initialize a delayable work item. &lt;br /&gt;This function takes two arguments: a pointer to the delayable work item and a pointer to the work handler function. In this case,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;&amp;amp;uart_work&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is the delayable work item and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;uart_work_handler&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is the work handler function.&lt;/div&gt;
&lt;div&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;uart_work_handler&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function is a callback function that is scheduled to run in the system workqueue context. In the&amp;nbsp;Peripheral UART sample, this function is responsible for handling UART work like,&amp;nbsp;&lt;span&gt;allocating memory for a&amp;nbsp;&lt;code dir="ltr"&gt;uart_data_t&lt;/code&gt;&amp;nbsp;structure, which is used to store UART data , after that, setting&lt;/span&gt;&amp;nbsp;the length of the data to 0. And if the memory allocation fails, it logs a warning message and reschedules the UART work after a delay. It also enables the UART receiver with the allocated buffer.&lt;br /&gt;&lt;br /&gt;Regards,&lt;/div&gt;
&lt;div&gt;Priyanka&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Architecture of Bluetooth Peripheral Sample</title><link>https://devzone.nordicsemi.com/thread/490091?ContentTypeID=1</link><pubDate>Sat, 22 Jun 2024 18:45:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c261632-74ec-4a44-abbb-dac93340a6d7</guid><dc:creator>Ih3b</dc:creator><description>&lt;p&gt;I&amp;#39;m curious to know more about the k_work_init_delayable(&amp;amp;uart_work, uart_work_handler); in the code of Bluetooth Peripherla UART ( this line ) : &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bluetooth/central_uart/src/main.c#L278"&gt;https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bluetooth/central_uart/src/main.c#L278&lt;/a&gt; and what its uart_work_handler supposed to do in this sample ?&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Architecture of Bluetooth Peripheral Sample</title><link>https://devzone.nordicsemi.com/thread/489906?ContentTypeID=1</link><pubDate>Fri, 21 Jun 2024 09:50:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30da8631-0cda-49e5-9780-e25c50932b72</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please take a look at the &lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/lessons/lesson-4-serial-communication-uart/"&gt;Serial Communication UART course &lt;/a&gt;on the DevAcademy. There are also other basic samples there, which are explained in detailed.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>