<?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>Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26480/add-uart1-to-bluetoothds-example-on-nrf52840</link><description>Hi, I need some guidance or an more in-depth example on adding the necessary code to read/write on the UART1 using the serial module or something else. Everything I&amp;#39;ve tried so far causes a fatal crash when attempt to write on UART1. 
 I&amp;#39;ve started with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 Nov 2017 17:53:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26480/add-uart1-to-bluetoothds-example-on-nrf52840" /><item><title>RE: Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/thread/104215?ContentTypeID=1</link><pubDate>Wed, 08 Nov 2017 17:53:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d2121d2-6c5e-4dec-b418-28d27d5598e9</guid><dc:creator>SRose</dc:creator><description>&lt;p&gt;Perfect!  Thanks for all your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/thread/104214?ContentTypeID=1</link><pubDate>Wed, 08 Nov 2017 16:34:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:680bf389-94d1-4770-af5e-cf39f9355618</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The queues defined using &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.1.0/group__nrf__serial.html#ga3b5e442f2c40c36bf08c639ea1f3c13b"&gt;&lt;code&gt;NRF_SERIAL_QUEUES_DEF()&lt;/code&gt;&lt;/a&gt; will be implemented using &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.1.0/group__nrf__queue.html?cp=4_0_0_6_11_35"&gt;nrf_queue library&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Looking at the implementation of the macro, you can see that it creates an object of type &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.1.0/structnrf__serial__queues__t.html"&gt;&lt;code&gt;nrf_serial_queues_t&lt;/code&gt;&lt;/a&gt;, which point to both RX and TX queues. You can check the available queue size using the nrf_queue functions &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.1.0/group__nrf__queue.html?cp=4_0_0_6_11_35_9#ga93b9a431f1925dcab9b3830cdd913ecc"&gt;&lt;code&gt;nrf_queue_available_get()&lt;/code&gt;&lt;/a&gt;, &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.1.0/group__nrf__queue.html#gadf2deb71361828fc92cf595c794e8653"&gt;&lt;code&gt;nrf_queue_utilization_get()&lt;/code&gt;&lt;/a&gt;, &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.1.0/group__nrf__queue.html?cp=4_0_0_6_11_35_12#ga73d1fadf99a19aeac2af64d516bfb0da"&gt;&lt;code&gt;nrf_queue_is_empty()&lt;/code&gt;&lt;/a&gt;, and &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.1.0/group__nrf__queue.html?cp=4_0_0_6_11_35_13#gafeeafda71e2665dc7a653f5991e12ae1"&gt;&lt;code&gt;nrf_queue_is_full()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Using the names in the Serial example in the SDK, you can check available queue sizes like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;size_t rx_available = nrf_queue_available_get(serial_queues.p_rxq);
size_t tx_available = nrf_queue_available_get(serial_queues.p_txq);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/thread/104213?ContentTypeID=1</link><pubDate>Mon, 06 Nov 2017 14:37:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bdd69c03-acd3-4df9-bf4e-db198c4e7359</guid><dc:creator>SRose</dc:creator><description>&lt;p&gt;Jørgen, I think we figured this out.  It seems the next call to &lt;code&gt;nrf_serial_write()&lt;/code&gt; would return the timeout error if the TX queue was still filled with data and the call would overflow the TX queue. With flow ctrl in place, the sensor was having a problem reading the data fast enough.  We fixed that and data is being sent OK now.   Question, is there a way to check the amount of used bytes in the TX queue on Serial before calling &lt;code&gt;nrf_serial_write()&lt;/code&gt; to prevent overflow?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/thread/104211?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2017 15:12:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a94d70cb-4ddf-414e-9e54-c996486d1e8c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;0x000D (13) means &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group__nrf__error.html?cp=2_3_1_1_0_2_0_7_19#gaf3ac440fa84dedc1a80baab36da36f80"&gt;&lt;code&gt;NRF_ERROR_TIMEOUT&lt;/code&gt;&lt;/a&gt;, as I mentioned above. This error is thrown by &lt;code&gt;nrf_serial_write()&lt;/code&gt; when &lt;code&gt;timeout_ms&lt;/code&gt; is reached and there are still data left to be written.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/thread/104210?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2017 15:02:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e79f2836-ccdc-41b4-a75d-4642ac3f08fd</guid><dc:creator>SRose</dc:creator><description>&lt;p&gt;I updated the error handler to the new code.  This is the error code.
&lt;code&gt;&amp;lt;error&amp;gt; app: Error: ID: 16385, PC: 0x0&lt;/code&gt;
&lt;code&gt;&amp;lt;error&amp;gt; app: Error: Code: 0x000D (13), Line: 62, File: ./bcdlogic.c&lt;/code&gt;
where line 62 is the &lt;code&gt;APP_ERROR_CHECK(ret)&lt;/code&gt; call after my call to &lt;code&gt;nrf_serial_write&lt;/code&gt;.
I&amp;#39;m trying to figure out what this error code means...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/thread/104209?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2017 08:18:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1357abc3-de0c-4036-a72c-7485ec9d0813</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You should set a breakpoint in &lt;code&gt;app_error_fault_handler&lt;/code&gt;, and check the error code manually, or you can add &lt;a href="https://devzone.nordicsemi.com/question/168515/debugging-problem-using-nrf_log/?answer=168602#post-id-168602"&gt;this code&lt;/a&gt; to print the error. Make sure you set optimization to -O0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/thread/104212?ContentTypeID=1</link><pubDate>Thu, 02 Nov 2017 19:09:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bb8e323-5dd5-453d-86f0-85983a12bfe7</guid><dc:creator>SRose</dc:creator><description>&lt;p&gt;Hi Jørgen.  The return value of &lt;code&gt;nrf_serial_init()&lt;/code&gt; is &lt;code&gt;NRF_SUCCESS&lt;/code&gt;.  Also the first call to &lt;code&gt;nrf_serial_write()&lt;/code&gt; is &lt;code&gt;NRF_SUCCESS&lt;/code&gt;  The second call causes the reboot.  Changing the &lt;code&gt;timeout_ms&lt;/code&gt; to 1000 didn&amp;#39;t change anything.  I&amp;#39;ve added the &lt;code&gt;#define DEBUG&lt;/code&gt;, which stopped the rebooting, but the only line I have in the logging is &lt;code&gt;&amp;lt;error&amp;gt; app: Fatal&lt;/code&gt;   After playing around,   I set my sensor to no flow ctrl and changed the setup to &lt;code&gt;NRF_UART_HWFC_DISABLED&lt;/code&gt;.  After I did this I am able to send and receive on UART1.   Does this give any insight on why flow ctrl would cause an error?  Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add UART1 to bluetoothds example on nrf52840</title><link>https://devzone.nordicsemi.com/thread/104208?ContentTypeID=1</link><pubDate>Wed, 01 Nov 2017 15:44:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89bcd630-9ebf-4c8f-ab58-8a6118712d34</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Have you &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;debugged&lt;/a&gt; the application and checked the return value from &lt;code&gt;nrf_serial_init()&lt;/code&gt; and &lt;code&gt;nrf_serial_write()&lt;/code&gt;? I tried your code and get &lt;code&gt;NRF_ERROR_TIMEOUT&lt;/code&gt; (0x0D) from &lt;code&gt;nrf_serial_write()&lt;/code&gt;. Increasing the &lt;code&gt;timeout_ms&lt;/code&gt; parameter solves this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>