<?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>Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23690/adding-uarte1-to-cli-openthread-example</link><description>Hi everyone, 
 I wanted to add a second UART (UARTE1) to the CLI example in the OpenThread SDK 0.10.0 since UART0 is used by CLI but I was not able to find any documentation on using two UARTs at the same time other than a clue in the header file &amp;quot;app_uart</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 17 Aug 2018 08:48:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23690/adding-uarte1-to-cli-openthread-example" /><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/144655?ContentTypeID=1</link><pubDate>Fri, 17 Aug 2018 08:48:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8694bbf-571f-4fc2-9bee-37b9d30a76f2</guid><dc:creator>Robert Lubos</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;First of all, I can see that in your config file, you are enabling UART0 with &lt;strong&gt;#define UART0_ENABLED 1&lt;/strong&gt;. Again, you cannot do that with OpenThread, as it uses this peripheral, unless you disable OpenThread CLI.&lt;/p&gt;
&lt;p&gt;But regarding your question and adding UARTE1 support to simple_coap_server. I&amp;#39;ve followed the description I&amp;#39;ve posted some time ago and was able to compile the project with app_uart and UARTE1 enabled, though I had to take nrfx into consideration, as it&amp;#39;s a part of current SDK, and was not present when the answer was posted. So lets iterate through the steps needed to add this support (and use &lt;strong&gt;uart&lt;/strong&gt; peripheral sample as a reference for the configuration):&lt;/p&gt;
&lt;p&gt;1. Modify the simple_coap_server makefile by adding the following lines to the &lt;em&gt;SRC_FILES&lt;/em&gt; section:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c \
$(SDK_ROOT)/components/libraries/fifo/app_fifo.c \
$(SDK_ROOT)/components/libraries/uart/app_uart_fifo.c \&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;2. Modify the simple_coap_server makefile by adding the following lines to the &lt;em&gt;INC_FOLDERS&lt;/em&gt; section:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;$(SDK_ROOT)/components/libraries/fifo \
$(SDK_ROOT)/components/libraries/uart \&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;3. Remove the &lt;strong&gt;CFLAGS += -DUART_ENABLED=0&lt;/strong&gt;&amp;nbsp;and &lt;strong&gt;ASMFLAGS += -DUART_ENABLED=0&lt;/strong&gt;&amp;nbsp;lines from the makefile&lt;br /&gt;4. From &lt;strong&gt;uart&lt;/strong&gt; peripheral sample &lt;em&gt;sdk_config.h&lt;/em&gt; file, copy the configuration enabling UART. This includes &lt;strong&gt;NRFX_UART*&lt;/strong&gt; configs as well. As for the &lt;em&gt;nRF5 SDK for Thread and Zigbee v.1.0.0&lt;/em&gt;, you should copy all configs from &lt;strong&gt;NRFX_UARTE_ENABLED&lt;/strong&gt;&amp;nbsp;to &lt;strong&gt;APP_UART_DRIVER_INSTANCE&lt;/strong&gt;&amp;nbsp;(inclusive).&lt;br /&gt;5. Disable UART0 by setting &lt;strong&gt;#define UART0_ENABLED 0&lt;/strong&gt;&amp;nbsp;and enable UARTE1 by setting &lt;strong&gt;#define UART1_ENABLED 1&lt;/strong&gt;. Finally, set correct UART instance for app_uart to use - &lt;strong&gt;#define APP_UART_DRIVER_INSTANCE 1&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Following these steps should result in having app_uart over UARTE1 enabled in simple_coap_server, ready to use.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Robert&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/143620?ContentTypeID=1</link><pubDate>Thu, 09 Aug 2018 15:29:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5c3e38a-8de0-4a7f-9861-933a79309239</guid><dc:creator>Lukasz Iwanecki</dc:creator><description>&lt;p&gt;Hi Robert,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve been trying to run UART1 in&amp;nbsp;simple_coap_server&amp;nbsp;project. I followed your steps, but with no success. So I decided to reproduce them in pure uart example first. I modified sdk_config.h as you described:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;sdk_config.h

// &amp;lt;e&amp;gt; UART0_ENABLED - Enable UART0 instance
//==========================================================
#ifndef UART0_ENABLED
#define UART0_ENABLED 1
#endif

// ...

// &amp;lt;e&amp;gt; UART1_ENABLED - Enable UART1 instance
//==========================================================
#ifndef UART1_ENABLED
#define UART1_ENABLED 1
#endif

// ...

#ifndef APP_UART_DRIVER_INSTANCE
#define APP_UART_DRIVER_INSTANCE 1
#endif

&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;However I got the following errors:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;Compiling file: app_uart_fifo.c
In file included from ../../../../../../modules/nrfx/nrfx.h:45:0,
                 from ../../../../../../integration/nrfx/legacy/nrf_drv_uart.h:44,
                 from ../../../../../../components/libraries/uart/app_uart_fifo.c:44:
../../../../../../modules/nrfx/drivers/include/nrfx_uart.h:79:35: error: &amp;#39;NRF_UART1&amp;#39; undeclared here (not in a function)
     .p_reg        = NRFX_CONCAT_2(NRF_UART, id),             \
                                   ^
../../../../../../modules/nrfx/drivers/nrfx_common.h:94:37: note: in definition of macro &amp;#39;NRFX_CONCAT_2_&amp;#39;
 #define NRFX_CONCAT_2_(p1, p2)      p1 ## p2
                                     ^~
../../../../../../modules/nrfx/drivers/include/nrfx_uart.h:79:21: note: in expansion of macro &amp;#39;NRFX_CONCAT_2&amp;#39;
     .p_reg        = NRFX_CONCAT_2(NRF_UART, id),             \
                     ^~~~~~~~~~~~~
../../../../../../integration/nrfx/legacy/nrf_drv_uart.h:78:17: note: in expansion of macro &amp;#39;NRFX_UART_INSTANCE&amp;#39;
         .uart = NRFX_UART_INSTANCE(id),
                 ^~~~~~~~~~~~~~~~~~
../../../../../../integration/nrfx/legacy/nrf_drv_uart.h:166:5: note: in expansion of macro &amp;#39;NRF_DRV_UART_CREATE_UART&amp;#39;
     NRF_DRV_UART_CREATE_UART(id)  \
     ^~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../components/libraries/uart/app_uart_fifo.c:47:39: note: in expansion of macro &amp;#39;NRF_DRV_UART_INSTANCE&amp;#39;
 static nrf_drv_uart_t app_uart_inst = NRF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);
                                       ^~~~~~~~~~~~~~~~~~~~~
../../../../../../modules/nrfx/drivers/include/nrfx_uart.h:80:35: error: &amp;#39;NRFX_UART1_INST_IDX&amp;#39; undeclared here (not in a function)
     .drv_inst_idx = NRFX_CONCAT_3(NRFX_UART, id, _INST_IDX), \
                                   ^
../../../../../../modules/nrfx/drivers/nrfx_common.h:117:37: note: in definition of macro &amp;#39;NRFX_CONCAT_3_&amp;#39;
 #define NRFX_CONCAT_3_(p1, p2, p3)  p1 ## p2 ## p3
                                     ^~
../../../../../../modules/nrfx/drivers/include/nrfx_uart.h:80:21: note: in expansion of macro &amp;#39;NRFX_CONCAT_3&amp;#39;
     .drv_inst_idx = NRFX_CONCAT_3(NRFX_UART, id, _INST_IDX), \
                     ^~~~~~~~~~~~~
../../../../../../integration/nrfx/legacy/nrf_drv_uart.h:78:17: note: in expansion of macro &amp;#39;NRFX_UART_INSTANCE&amp;#39;
         .uart = NRFX_UART_INSTANCE(id),
                 ^~~~~~~~~~~~~~~~~~
../../../../../../integration/nrfx/legacy/nrf_drv_uart.h:166:5: note: in expansion of macro &amp;#39;NRF_DRV_UART_CREATE_UART&amp;#39;
     NRF_DRV_UART_CREATE_UART(id)  \
     ^~~~~~~~~~~~~~~~~~~~~~~~
../../../../../../components/libraries/uart/app_uart_fifo.c:47:39: note: in expansion of macro &amp;#39;NRF_DRV_UART_INSTANCE&amp;#39;
 static nrf_drv_uart_t app_uart_inst = NRF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);
                                       ^~~~~~~~~~~~~~~~~~~~~&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do I&amp;nbsp;miss something?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;SDK: nRF5 SDK for Thread and Zigbee&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93136?ContentTypeID=1</link><pubDate>Thu, 14 Sep 2017 12:46:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db31eb67-604b-461d-80c3-bb2f1d81e8e7</guid><dc:creator>Roger</dc:creator><description>&lt;p&gt;Got it working. Thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93137?ContentTypeID=1</link><pubDate>Thu, 14 Sep 2017 06:41:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:907fcad2-b0f4-49da-8a95-aac65aa9fee9</guid><dc:creator>Robert Lubos</dc:creator><description>&lt;p&gt;If you do not want to use CLI, simply do not initialize it. I cannot post files via comment section, but the steps are pretty simple, so you can reproduce them. I have modified the OpenThread CLI form Thread SDK, as it&amp;#39;s the simplest, but you can apply these steps to any Thread example:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add OT UART header : &lt;code&gt;#include &amp;lt;openthread/platform/uart.h&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;otCliUartInit(p_instance);&lt;/code&gt; with &lt;code&gt;otPlatUartEnable();&lt;/code&gt; to enable UART0 (CLI does it by itself).&lt;/li&gt;
&lt;li&gt;Create receive handler, for example:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code&gt;void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
    (void)aBuf;
    (void)aBufLength;
    bsp_board_led_invert(BSP_BOARD_LED_3);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;ol start="4"&gt;
&lt;li&gt;In a Makefile, remove the line that linked CLI library:
&lt;code&gt;$(SDK_ROOT)/external/openthread/lib/gcc/libopenthread-cli-ftd.a \&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After reproducing these steps you will be able to control UART0 manually from the application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93131?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 14:33:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ca67086-3ff9-4218-8df6-cdb10701e910</guid><dc:creator>Roger</dc:creator><description>&lt;p&gt;No, I don&amp;#39;t have to use the OpenThread CLI since I can manually configure the network in main() using the API. I&amp;#39;m assuming after disabling the OpenThread CLI and then using &lt;code&gt;otPlatUartReceived&lt;/code&gt;, I have to enable &lt;code&gt;UART0&lt;/code&gt; and disable &lt;code&gt;UART1&lt;/code&gt;. Is there a function in the API to disable the OpenThread CLI?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93135?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 13:40:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98fc507b-8cec-4a77-bae1-dec07c292056</guid><dc:creator>Robert Lubos</dc:creator><description>&lt;p&gt;If you want to communicate with a nRF52840 through the SEGGER J-LINK COM port, you have to use those pins. But initializing second UART instance on the same pins is not a good approach, beacause you will get collissions on transmit/receive.
Do you need to have OpenThread CLI enabled? If not, there is an option to disable OpenThread CLI in the aplication, and register application&amp;#39;s own &lt;code&gt;otPlatUartReceived&lt;/code&gt; handler. This way you can use OpenThread UART driver for communication via built-in USB serial port.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93134?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 12:50:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:170e5ec4-8b85-4420-a254-2e61d902a659</guid><dc:creator>Roger</dc:creator><description>&lt;p&gt;I would like to receive bytes from a COM port connected through the USB cable plugged into the nRF52840. I&amp;#39;m not sure I follow correctly but to my understanding I&amp;#39;m still using the same &lt;code&gt;NRF_LOG_BACKEND_SERIAL_UART_TX_PIN 6&lt;/code&gt; and &lt;code&gt;NRF_LOG_BACKEND_SERIAL_UART_RX_PIN 8&lt;/code&gt; pins. Can you please provide an example to &amp;quot;If you want to use another instance of UART, you need to choose other, unused pins to initialize the UART instance&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93133?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 12:12:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d269d543-0c80-4a86-af8a-3c51a3b64401</guid><dc:creator>Robert Lubos</dc:creator><description>&lt;p&gt;OpenThread CLI uses hardware pins 6 and 8 for UART communication, which are  connected to SEGGER J-LINK chip on the development board, which in turn enables to communicate with PC through USB. If you want to use another instance of UART, you need to choose other, unused pins to initialize the UART instance. In order to communicate with PC thorough that UART, you need an UART-USB converter though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93132?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 11:37:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4da0139c-8dd7-4f20-8e36-1ffd2b8058c9</guid><dc:creator>Roger</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I followed the same advice regarding configuring &lt;code&gt;UART1&lt;/code&gt; for communications from PC to nRF52840, but having issues getting it working. I posted a similar question in the following link at &lt;a href="https://devzone.nordicsemi.com/question/138337/including-app_uarth-in-main-program-of-simple_coap_server-example/"&gt;Including &amp;quot;app_uart.h&amp;quot; in main program of &amp;#39;simple_coap_server&amp;#39; example&amp;quot;&lt;/a&gt;. I would like to know what do you mean by &amp;quot;When initializing app_uart make sure to use other pins than UART0 does&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93129?ContentTypeID=1</link><pubDate>Tue, 25 Jul 2017 08:47:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:565747f0-0c5e-4b0d-ad8d-4bf3c899c73a</guid><dc:creator>Krzysztof Loska</dc:creator><description>&lt;p&gt;I think Jakub refers to Bluetooth LE CLI example, while the question is about Thread CLI example. For an answer about Thread CLI example see Robert&amp;#39;s response.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93130?ContentTypeID=1</link><pubDate>Mon, 24 Jul 2017 08:57:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3829b745-dd55-4a70-bc4f-cfbf54bd0342</guid><dc:creator>Robert Lubos</dc:creator><description>&lt;p&gt;Hi,
As you already noticed, OpenThread CLI uses UART0 and that cannot be changed without modyfing OpenThread driver and rebuilding libraries.&lt;/p&gt;
&lt;p&gt;You should be able though to use UARTE1 with app_uart in OpenThread CLI as a secondary UART. Unfortunately OpenThread CLI example does not provide app_uart support by default, so you will have to add &lt;code&gt;app_uart&lt;/code&gt; and &lt;code&gt;nrf_drv_uart&lt;/code&gt; manually to the project. You can use UART peripheral example as a reference. Make sure to copy respective configuration from &lt;code&gt;sdk_config.h&lt;/code&gt; as well.&lt;/p&gt;
&lt;p&gt;Keep in mind, that you have to modify default sdk_config.h configuration. Disable  UART0 in &lt;code&gt;nrf_drv_uart&lt;/code&gt; by setting &lt;code&gt;UART0_ENABLED 0&lt;/code&gt;, as this peripheras is owned by OpenThread driver. To enable UARTE1 in &lt;code&gt;app_uart&lt;/code&gt;, set &lt;code&gt;UART1_ENABLED 1&lt;/code&gt; and &lt;code&gt;APP_UART_DRIVER_INSTANCE 1&lt;/code&gt;. When initializing &lt;code&gt;app_uart&lt;/code&gt; make sure to use other pins than UART0 does.&lt;/p&gt;
&lt;p&gt;The last thing is to remove &lt;code&gt;-DUART_ENABLED=0&lt;/code&gt; from the makefile, as we do want to use the UART driver from SDK now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UARTE1 to CLI OpenThread Example</title><link>https://devzone.nordicsemi.com/thread/93128?ContentTypeID=1</link><pubDate>Mon, 24 Jul 2017 06:47:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d75bab57-737d-4501-89dd-96327b5eabb1</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Hi,
Unfortunately in OpenThread SDK 0.10.0 (based on SDK 13) UART0 is &amp;quot;hardcoded&amp;quot; to be used with CLI.
In comming SDK14 we have significantly refactored CLI module and it will be possible to use UART0 or/and UART1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>