<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>UARTE.h</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/87922/uarte-h</link><description>I was at 1st trying to use libuarte and it worked. However, talking to Edvin has convinced me to use something else as it is very resource heavy and I do not particularly need libuarte. So, I moved to uarte. I found no coding example of uarte online or</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 18 May 2022 10:16:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/87922/uarte-h" /><item><title>RE: UARTE.h</title><link>https://test-devzone.nordicsemi.com/thread/368276?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 10:16:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa292996-3543-4e23-bad3-0a6ac064b15d</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;I don&amp;#39;t know why setting pin14 to low works. Actually I wanted you to have a look at the ble_app_uart example, but if this is working, I guess it is fine.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regarding pin 14, I suggest you try to debug to see why it is not working. Is the main() function reached? If yes, you should check the return values for the functions that returns something, such as nrf_uarte_configure(). What do they return? (not only nrf_uarte_configure, but pretty much all your uart related functions).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also see that you don&amp;#39;t have a while loop in your main function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    while(1) {
      break;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This will break out of the while loop on entry, and then skip to &amp;quot;return 0;&amp;quot;, and at that point your application is &amp;quot;done&amp;quot;. It is not defined what the chip should do then. Perhaps you added some more code to the while loop when you also added the pin 14 part, which made it work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE.h</title><link>https://test-devzone.nordicsemi.com/thread/368119?ContentTypeID=1</link><pubDate>Mon, 16 May 2022 22:50:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86890660-2341-4e67-9ed9-d4e4b57ac595</guid><dc:creator>user116078</dc:creator><description>&lt;p&gt;Hello, I found out that adding the following line solves the issue:&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg_output(14);&lt;br /&gt;nrf_gpio_pin_write(14, false);&lt;/p&gt;
&lt;p&gt;could you please explain why adding these two lines at the beginning main() function allows for successful communication? Without these 2 lines, I do not get any response. Why pin 14 exactly? I do not see anything that is connected to pin 14.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE.h</title><link>https://test-devzone.nordicsemi.com/thread/368096?ContentTypeID=1</link><pubDate>Mon, 16 May 2022 15:08:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af9ad4e8-d7a4-4561-be07-574cfd2d6c70</guid><dc:creator>user116078</dc:creator><description>&lt;p&gt;Hello, I am found out that adding the following line solves the issue:&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg_output(14);&lt;br /&gt; nrf_gpio_pin_write(14, false);&lt;/p&gt;
&lt;p&gt;could you please explain why adding these two lines at the beginning main() function allows for successful communication? Without these 2 lines, I do not get any response. Why pin 14 exactly? I do not see anything that is connected to pin 14.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE.h</title><link>https://test-devzone.nordicsemi.com/thread/368018?ContentTypeID=1</link><pubDate>Mon, 16 May 2022 10:33:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6734b6bd-719e-4504-adc7-63979645abff</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;It doesn&amp;#39;t really look like there is any sensitive information in the code, but you should be able to edit the original post.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What I was thinking of when I mentioned that the libuarte was a bit resource heavy is that it requires both a timer and an RTC to operate, while for most applications this is a bit overkill.&lt;/p&gt;
&lt;p&gt;I suggest that you look into the ble_app_uart example found in SDK\examples\ble_peripheral\ble_app_uart. Look at how it sets up the uart in uart_init() from main.c, and how the event handler,&amp;nbsp;uart_event_handle() is handling the incoming bytes. Note that this interrupt will trigger on every byte, but the byte will be added to the data_array[] parameter, and it checks whether the last byte is an \n or an \r (or if the buffer is filled). If it is, then it will trigger some action, which in this case is sending the array via ble_nus_data_send(..., data_array, ...).&lt;/p&gt;
&lt;p&gt;You can also see how it writes data on the uart using app_uart_put() inside the nus_data_handler() in main.c. You can do something similar to send the command that you need to send. Alternatively, you can see that it uses printf() in the main() function to send &amp;quot;\r\nUart started.\r\n&amp;quot; when the application is starting. This printf() function is enabled by adding the retarget.c, but if you struggle to get this working in your own custom application, I would suggest that you just use app_uart_put.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE.h</title><link>https://test-devzone.nordicsemi.com/thread/367906?ContentTypeID=1</link><pubDate>Sat, 14 May 2022 02:24:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f01ac088-8730-4291-83c8-3287a762e0ac</guid><dc:creator>user116078</dc:creator><description>&lt;p&gt;Also is there a way for me to delete this code once I get an answer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>