<?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 SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50416/nrf-sdk-15-3-uart-example-is-not-working---nrf52840-pca10056</link><description>Hi DevZone, 
 
 I am developing an application that needs to use UART communication with the nRF52840 pca10056 board. 
 I am using Segger Embedded Studio V4.16 
 
 I checked out the UART example found in the SDK files under \examples\peripheral\uart\pca10056</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 01 Aug 2019 06:24:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50416/nrf-sdk-15-3-uart-example-is-not-working---nrf52840-pca10056" /><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201737?ContentTypeID=1</link><pubDate>Thu, 01 Aug 2019 06:24:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51a27806-3c2c-49f2-9169-9e0be8d46837</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Interesting read. This will probably save me in the near future. I did spend some time looking into&amp;nbsp;the wrong things because of the NRF_ERROR_NO_MEM message.&lt;/p&gt;
&lt;p&gt;Thank you for posting!&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201489?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 10:01:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2983ad53-d33b-4f50-b0b7-1a0d80bacccd</guid><dc:creator>awneil</dc:creator><description>[quote userid="80129" url="~/f/nordic-q-a/50416/nrf-sdk-15-3-uart-example-is-not-working---nrf52840-pca10056/201447"]I don&amp;#39;t know why I got a NRF_ERROR_NO_MEM error code from this mistake[/quote]
&lt;p&gt;Possibly because you were getting framing errors on the UART:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/41480/multiperipheral-nus-crashes/161677#161677"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/41480/multiperipheral-nus-crashes/161677#161677&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201447?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 08:37:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72749a3d-ba03-4dce-89cf-5c4baf681636</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;I have located the problem.&lt;/p&gt;
&lt;p&gt;The UART on the development kit uses pins P0.05, P0.06, P0.07, P0.08.&lt;/p&gt;
&lt;p&gt;I was using one if these pins (P0.08) for another device connected to the development kit.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know why I got a NRF_ERROR_NO_MEM error code from this mistake, but at least now the example works as expected with echoing keyboard inputs on the terminal.&lt;/p&gt;
&lt;p&gt;Thank you for helping me. It is much appreciated! :)&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201434?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 08:13:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:319994ed-a2e5-4ab7-a129-52efc8d9e024</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;I have learned that error code 0x0000004 is representing&amp;nbsp;&lt;span&gt;NRF_ERROR_NO_MEM.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;When I build my project the memory allocation looks as follows:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/2080x604/__key/communityserver-discussions-components-files/4/uartbuild.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is this the same for you?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Br. Casper&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201431?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 08:07:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a0b6e56-23f7-43e8-a32f-e94e5bab5119</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;After the first fault I was worried about the same thing, so I unzipped a fresh copy of the SDK. But that did not solve the problem either.&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201413?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 07:11:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a14eab39-ac24-4183-a454-175e7f381871</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Have you modified any source files used by different drivers in the SDK?&lt;/p&gt;
&lt;p&gt;Could you try to compile the example from a&lt;a href="https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip"&gt; clean SDK&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201412?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 07:07:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27c28ca5-0cfa-43c9-916d-d9568f3d4673</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes I compiled it straight out of the box. Just tried copying your code in and the error persists I am afraid.&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT:&lt;br /&gt;From what I can see when debugging, then the &lt;strong&gt;m_event_handler(&amp;amp;app_uart_event);&amp;nbsp;&lt;/strong&gt;is called in&amp;nbsp;&lt;strong&gt;app_uart_fifo.c&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This then goes directly into the&amp;nbsp;&lt;strong&gt;app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&amp;amp;error_info));&amp;nbsp;&lt;/strong&gt;in line 73 in&amp;nbsp;&lt;strong&gt;app_error.c&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;The error code is 0x00000004&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201410?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 07:05:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3fa3fa9-9cb9-4b6f-84a9-1d33064ad5fd</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;You compiled it out of the box?&lt;/p&gt;
&lt;p&gt;It works fine for me:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/430x205/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-edf5a34e74804d7f8cac541ef312d1a5/pastedimage1564556649726v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;The code I&amp;#39;m running:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Copyright (c) 2014 - 2019, Nordic Semiconductor ASA
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 *
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 *
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
/** @file
 * @defgroup uart_example_main main.c
 * @{
 * @ingroup uart_example
 * @brief UART Example Application main file.
 *
 * This file contains the source code for a sample application using UART.
 *
 */

#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;quot;app_uart.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#if defined (UART_PRESENT)
#include &amp;quot;nrf_uart.h&amp;quot;
#endif
#if defined (UARTE_PRESENT)
#include &amp;quot;nrf_uarte.h&amp;quot;
#endif


//#define ENABLE_LOOPBACK_TEST  /**&amp;lt; if defined, then this example will be a loopback test, which means that TX should be connected to RX to get data loopback. */

#define MAX_TEST_DATA_BYTES     (15U)                /**&amp;lt; max number of test bytes to be used for tx and rx. */
#define UART_TX_BUF_SIZE 256                         /**&amp;lt; UART TX buffer size. */
#define UART_RX_BUF_SIZE 256                         /**&amp;lt; UART RX buffer size. */

void uart_error_handle(app_uart_evt_t * p_event)
{
    if (p_event-&amp;gt;evt_type == APP_UART_COMMUNICATION_ERROR)
    {
        APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication);
    }
    else if (p_event-&amp;gt;evt_type == APP_UART_FIFO_ERROR)
    {
        APP_ERROR_HANDLER(p_event-&amp;gt;data.error_code);
    }
}


#ifdef ENABLE_LOOPBACK_TEST
/* Use flow control in loopback test. */
#define UART_HWFC APP_UART_FLOW_CONTROL_ENABLED

/** @brief Function for setting the @ref ERROR_PIN high, and then enter an infinite loop.
 */
static void show_error(void)
{

    bsp_board_leds_on();
    while (true)
    {
        // Do nothing.
    }
}


/** @brief Function for testing UART loop back.
 *  @details Transmitts one character at a time to check if the data received from the loopback is same as the transmitted data.
 *  @note  @ref TX_PIN_NUMBER must be connected to @ref RX_PIN_NUMBER)
 */
static void uart_loopback_test()
{
    uint8_t * tx_data = (uint8_t *)(&amp;quot;\r\nLOOPBACK_TEST\r\n&amp;quot;);
    uint8_t   rx_data;

    // Start sending one byte and see if you get the same
    for (uint32_t i = 0; i &amp;lt; MAX_TEST_DATA_BYTES; i++)
    {
        uint32_t err_code;
        while (app_uart_put(tx_data[i]) != NRF_SUCCESS);

        nrf_delay_ms(10);
        err_code = app_uart_get(&amp;amp;rx_data);

        if ((rx_data != tx_data[i]) || (err_code != NRF_SUCCESS))
        {
            show_error();
        }
    }
    return;
}
#else
/* When UART is used for communication with the host do not use flow control.*/
#define UART_HWFC APP_UART_FLOW_CONTROL_DISABLED
#endif


/**
 * @brief Function for main application entry.
 */
int main(void)
{
    uint32_t err_code;

    bsp_board_init(BSP_INIT_LEDS);

    const app_uart_comm_params_t comm_params =
      {
          RX_PIN_NUMBER,
          TX_PIN_NUMBER,
          RTS_PIN_NUMBER,
          CTS_PIN_NUMBER,
          UART_HWFC,
          false,
#if defined (UART_PRESENT)
          NRF_UART_BAUDRATE_115200
#else
          NRF_UARTE_BAUDRATE_115200
#endif
      };

    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);

#ifndef ENABLE_LOOPBACK_TEST
    printf(&amp;quot;\r\nUART example started.\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.
            }
        }
    }
#else

    // This part of the example is just for testing the loopback .
    while (true)
    {
        uart_loopback_test();
    }
#endif
}


/** @} */
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201409?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2019 07:03:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b72dde51-1e02-4acc-8ed8-fc69535a7f08</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Yes I also tried enabling loopback test, but the same error occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF SDK 15.3 UART example is not working. - nRF52840 pca10056</title><link>https://devzone.nordicsemi.com/thread/201363?ContentTypeID=1</link><pubDate>Tue, 30 Jul 2019 20:23:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89fe4580-203a-475c-8990-6c8bff24d8ee</guid><dc:creator>BinderT</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Have you added this macro in. It&amp;#39;s commented out by default.&lt;br /&gt;&lt;br /&gt;line 66 in the example&lt;br /&gt;#define ENABLE_LOOPBACK_TEST&lt;br /&gt;&lt;br /&gt;Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>