<?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>Simple UART program doesn&amp;#39;t send data to another device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50492/simple-uart-program-doesn-t-send-data-to-another-device</link><description>Hi all, 
 I am trying to send data from nrf52840 to Arduino. I have a simple UART program running on nrf52840 that is supposed to transmit a character to another device(Arduino in this case) through TX/RX. I just want it to send a character &amp;#39;a&amp;#39; for now</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Apr 2022 07:16:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50492/simple-uart-program-doesn-t-send-data-to-another-device" /><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/365095?ContentTypeID=1</link><pubDate>Wed, 27 Apr 2022 07:16:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c95eb439-d882-439c-9feb-41f4201ae5b0</guid><dc:creator>Vijayneerukanti</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am also in the process of using the uart for sending the data from nrf52832 to esp32 wifi module. I would like to know if you are able to solve the issue. I would like to request you to share your views on it.&lt;/p&gt;
&lt;p&gt;Thanks in advance!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/282973?ContentTypeID=1</link><pubDate>Thu, 03 Dec 2020 05:22:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e5f7674-1a2d-4454-a9f3-cdecf02c0368</guid><dc:creator>Rathna Kumar</dc:creator><description>&lt;p&gt;I am also facing the same problem. Do you have any solutions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/202300?ContentTypeID=1</link><pubDate>Mon, 05 Aug 2019 06:21:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88ead942-a2cf-4657-839f-9c62464fe851</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I tried it with PCA10056 DK on both ends&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/202217?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 17:11:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc06140a-34df-4413-a938-fdca9039b7a1</guid><dc:creator>davidm</dc:creator><description>&lt;p&gt;Thank you for trying. what is the other device you used, I tried with Arduino and esp32 but both didn&amp;#39;t work.And the Pin I used are RX-08 and TX-06 on NRF52840.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/202038?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 07:31:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da0144c9-0a5b-44b2-8340-969154f8d25e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;tried your code on putty/TeraTerm and connected it to another device in receive mode. All of them work as they should. Something must be wrong with how you have configured the RX pin on the peer device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/201992?ContentTypeID=1</link><pubDate>Thu, 01 Aug 2019 19:22:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af81fa16-598a-481d-bbe5-a3093aa439c9</guid><dc:creator>davidm</dc:creator><description>&lt;p&gt;Ok Thank you , here is full code, I am currently using SDK 15.2, but i tried 15.3 was the same outcome&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#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;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.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 started2.\r\n&amp;quot;);
 
    while (true)
    { 
        while (app_uart_put(&amp;#39;7&amp;#39;) != NRF_SUCCESS);
    }
#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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/201989?ContentTypeID=1</link><pubDate>Thu, 01 Aug 2019 18:53:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34fcd7bc-1941-43da-923e-54abc34a507b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The code snippet you showed was confused me as you showed the whole main function without uart initialization. Can you give me your project so that I do a quick test?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/201980?ContentTypeID=1</link><pubDate>Thu, 01 Aug 2019 16:47:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8a776f1-9003-41f5-adad-bc486d12679d</guid><dc:creator>davidm</dc:creator><description>&lt;p&gt;Yes I initiliazed it, I am using the same code in&lt;span&gt;\examples\peripheral\uart\main.c&amp;nbsp; &lt;/span&gt;.Keep in mind I mentioned that it works when I send to CoolTerm terminal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple UART program doesn't send data to another device</title><link>https://devzone.nordicsemi.com/thread/201841?ContentTypeID=1</link><pubDate>Thu, 01 Aug 2019 11:42:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebfe5359-c82c-4fe0-9d4d-98c5f9bc0a32</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You need to first initialize app_uart module to be able to use it.&lt;/p&gt;
&lt;p&gt;Please look at the example in SDK15.3\examples\peripheral\uart\main.c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>