<?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>Including &amp;quot;app_uart.h&amp;quot; in main program of &amp;#39;simple_coap_server&amp;#39; example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22160/including-app_uart-h-in-main-program-of-simple_coap_server-example</link><description>HI All, 
 I wonder if someone can help me out. I would like to send serial data by modifying the &amp;#39;simple_coap_server&amp;#39; main program. I added the following header &amp;#39;app_uart.h&amp;#39; to make use of the functions but when I compile the program using GCC (&amp;#39;make</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Sep 2017 12:58:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22160/including-app_uart-h-in-main-program-of-simple_coap_server-example" /><item><title>RE: Including "app_uart.h" in main program of 'simple_coap_server' example</title><link>https://devzone.nordicsemi.com/thread/87105?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2017 12:58:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14b50ecb-f7af-4744-a772-a51df85a7d03</guid><dc:creator>Roger</dc:creator><description>&lt;p&gt;Thanks again. Very helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including "app_uart.h" in main program of 'simple_coap_server' example</title><link>https://devzone.nordicsemi.com/thread/87106?ContentTypeID=1</link><pubDate>Fri, 19 May 2017 13:41:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4d1e2c9-94f2-4060-b115-5347c907720e</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;There are a few things needed to get UART working. In addition to adding the path to the header files, you need to include the source files &lt;em&gt;app_uart_fifo.c&lt;/em&gt;, &lt;em&gt;app_fifo.c&lt;/em&gt;, and &lt;em&gt;nrf_drv_uart.c&lt;/em&gt; in your project/Makefile. You will also have to add the paths to the header files of these additional libraries. Then, you need to enable all the modules in &lt;em&gt;sdk_config.h&lt;/em&gt; by setting the correct defines. Finally, if you also want to use &lt;code&gt;printf()&lt;/code&gt; functionality for the UART interface, you need to incude the source file &lt;em&gt;retarget.c&lt;/em&gt;, and enable this module in &lt;em&gt;sdk_config.h&lt;/em&gt; as well. I see that these are not included in the config file for the Thread examples, so I created &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5417.Makefile"&gt;Makefile&lt;/a&gt; and &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2425.sdk_5F00_config.h"&gt;sdk_config.h&lt;/a&gt; file that should work for you. Note that &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.threadsdk.v0.9.0/thread_intro.html?cp=4_1_0_1"&gt;&lt;code&gt;UART0&lt;/code&gt; peripheral is owned by OpenThread stack&lt;/a&gt; and cannot be used by the application. You are therefore required to use UART1 when adding UART to your application. I suggest you check the differences between these files and the original ones to understand how to add new modules.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including "app_uart.h" in main program of 'simple_coap_server' example</title><link>https://devzone.nordicsemi.com/thread/87104?ContentTypeID=1</link><pubDate>Fri, 19 May 2017 12:30:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b456d67-249a-4689-bd8f-74dabe02ae62</guid><dc:creator>Roger</dc:creator><description>&lt;p&gt;Hello Jørgen,&lt;/p&gt;
&lt;p&gt;Seems like there is something still missing which I don&amp;#39;t fully understand. The &lt;em&gt;&amp;#39;simple_coap_server&amp;#39;&lt;/em&gt; compiles with no error after including $(SDK_ROOT)/components/libraries/uart \ in the INC_FOLDER of the Makefile. However, after including the following code from the &lt;em&gt;&amp;#39;UART&amp;#39;&lt;/em&gt; example to the main of &lt;em&gt;&amp;#39;simple_coap_server&amp;#39;&lt;/em&gt; example&amp;#39;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void) {

uint32_t err_code;

const app_uart_comm_params_t comm_params =
  {
      RX_PIN_NUMBER,
      TX_PIN_NUMBER,
      RTS_PIN_NUMBER,
      CTS_PIN_NUMBER,
      APP_UART_FLOW_CONTROL_ENABLED,
      false,
      UART_BAUDRATE_BAUDRATE_Baud115200
  };

APP_UART_FIFO_INIT(&amp;amp;comm_params,
                     UART_RX_BUF_SIZE,
                     UART_TX_BUF_SIZE,
                     uart_error_handle,
                     APP_IRQ_PRIORITY_LOWEST,
                     err_code);

APP_ERROR_CHECK(err_code);

printf(&amp;quot;\r\nStart: \r\n&amp;quot;);

while (true)
{
    uint8_t cr;
    while (app_uart_get(&amp;amp;cr) != NRF_SUCCESS);
    while (app_uart_put(cr) != NRF_SUCCESS);

    if (cr == &amp;#39;q&amp;#39; || cr == &amp;#39;Q&amp;#39;)
    {
        printf(&amp;quot; \r\nExit!\r\n&amp;quot;);

        while (true)
        {
            // Do nothing.
        }

    }

}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I get the following error:
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3323.error.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;It seems that the functions of &amp;quot;app_uart.h&amp;quot; used in main are still undefined. In the &lt;em&gt;&amp;#39;UART&amp;#39;&lt;/em&gt; example, I also checked that the headers and source files in the Makefile, are also included in the &lt;em&gt;&amp;#39;simple_coap_server&amp;#39;&lt;/em&gt; Makefile, but I still get an undefined reference to the functions.&lt;/p&gt;
&lt;p&gt;Are there perhaps any other files that need to be included? Any thoughts?&lt;/p&gt;
&lt;p&gt;Roger&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including "app_uart.h" in main program of 'simple_coap_server' example</title><link>https://devzone.nordicsemi.com/thread/87103?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 14:25:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fac5816-7ad0-4c22-9c31-62e8421b9fbb</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Happy to help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including "app_uart.h" in main program of 'simple_coap_server' example</title><link>https://devzone.nordicsemi.com/thread/87102?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 14:16:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e667810-cbe9-4bc5-b169-47d86a3bea47</guid><dc:creator>Roger</dc:creator><description>&lt;p&gt;I&amp;#39;m such a noob, thank you very much Jørgen, it worked. Learned something new today.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including "app_uart.h" in main program of 'simple_coap_server' example</title><link>https://devzone.nordicsemi.com/thread/87101?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 10:22:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f628ef22-2c20-4788-b239-9c7a76d1565c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Do you mean the simple_coap_server example in the Thread SDK? Have you added the path to the header file to INC_FOLDER in the Makefile?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$(SDK_ROOT)/components/libraries/uart \
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>