<?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>nrf_serial - how to tell available TX buffer space BEFORE using nrf_serial_write()</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33539/nrf_serial---how-to-tell-available-tx-buffer-space-before-using-nrf_serial_write</link><description>Hi, 
 
 I&amp;#39;m using nrf_serial &amp;#39;object&amp;#39; in order to communicate nRF52832 with an external device. 
 As I work in non-blocking mode I need to verify if there&amp;#39;s available space to send a whole message or not send it all. In any case, I shouldn&amp;#39;t send a partial</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 20 Apr 2018 10:19:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33539/nrf_serial---how-to-tell-available-tx-buffer-space-before-using-nrf_serial_write" /><item><title>RE: nrf_serial - how to tell available TX buffer space BEFORE using nrf_serial_write()</title><link>https://devzone.nordicsemi.com/thread/129119?ContentTypeID=1</link><pubDate>Fri, 20 Apr 2018 10:19:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af965ea6-880e-4347-9e51-0385fe6d9451</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That is correct, nrf_serial_write() returns the number of queued bytes. You can enable the event handler to get a callback when the data has actually been transferred.&lt;/p&gt;
&lt;p&gt;The serial library does not seem to&amp;nbsp;expose an API for checking available queue size, but you can&amp;nbsp;use&amp;nbsp;&lt;a title="nrf_queue_available_get" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/group__nrf__queue.html?cp=4_0_0_6_11_39_10#ga93b9a431f1925dcab9b3830cdd913ecc"&gt;nrf_queue_available_get&lt;/a&gt;() from queue module instead:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;available_buffer = nrf_queue_available_get(serial_queues.p_txq);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>