<?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>UART communication between nrf52 DK &amp;amp; other microcontroller</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39621/uart-communication-between-nrf52-dk-other-microcontroller</link><description>Hi, 
 I would like to establish UART communication between nrf52 DK &amp;amp; other microcontroller. I checked the uart example (peripheral folder) in SDK 15. I was not able to flash the code to nrf52 DK. But then I figured out that it does not use a softdevice</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Oct 2018 23:52:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39621/uart-communication-between-nrf52-dk-other-microcontroller" /><item><title>RE: UART communication between nrf52 DK &amp; other microcontroller</title><link>https://devzone.nordicsemi.com/thread/154735?ContentTypeID=1</link><pubDate>Fri, 26 Oct 2018 23:52:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:728c16a6-87f8-4b40-8019-5d3af5333e3b</guid><dc:creator>bscdb</dc:creator><description>&lt;p&gt;Hi msromero,&lt;/p&gt;
&lt;p&gt;nrf isnt sending out any data. My code is as follows -&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;boards.h&amp;quot;
#include &amp;quot;nrf_uart.h&amp;quot;
#include &amp;quot;nrf_uarte.h&amp;quot;

#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. */

uint8_t cr;

void uart_error_handle(app_uart_evt_t * p_event)
{
//	if (p_event-&amp;gt;evt_type == APP_UART_DATA_READY)
//    {
//		while (app_uart_get(&amp;amp;cr) != NRF_SUCCESS){};
//		if (cr == &amp;#39;9&amp;#39;)
//        {
//            bsp_board_led_invert(1);
//            nrf_delay_ms(500);
//        }
//		//while (app_uart_put(&amp;#39;?&amp;#39;) != NRF_SUCCESS);
//	}
//	else if (p_event-&amp;gt;evt_type == APP_UART_TX_EMPTY)
//    {
//        while (app_uart_put(&amp;#39;?&amp;#39;) != NRF_SUCCESS);
//    }
    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);
    }	
}

#define UART_HWFC APP_UART_FLOW_CONTROL_DISABLED /* When UART is used for communication with the host do not use flow control.*/

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,
          0,/*RTS_PIN_NUMBER,*/
          0,/*CTS_PIN_NUMBER,*/
          UART_HWFC,
          false,
          NRF_UART_BAUDRATE_9600//460800
      };
    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\nUART example started.\r\n&amp;quot;);
	
	for (uint8_t i = 0; i &amp;lt; 10; i++)
	{
		while (app_uart_put(i) != NRF_SUCCESS);
	}

    while(true)
    {
		
        //while (app_uart_get(&amp;amp;cr) != NRF_SUCCESS);
        //while (app_uart_put(cr) != NRF_SUCCESS);
//        if (cr == &amp;#39;9&amp;#39;)
//        {
//            bsp_board_led_invert(1);
//            nrf_delay_ms(500);
//        }
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART communication between nrf52 DK &amp; other microcontroller</title><link>https://devzone.nordicsemi.com/thread/154243?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 10:23:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d93a426d-cff9-44ad-8665-1b04cd268e5f</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;How to properly post source code:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3060.Insert-Code-_2D00_-Nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART communication between nrf52 DK &amp; other microcontroller</title><link>https://devzone.nordicsemi.com/thread/154230?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 09:09:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f376196a-9941-46f7-8939-bb815962815c</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi Sonal,&lt;/p&gt;
&lt;p&gt;There are some limitations about how many characters (letters/keys) you can send in one HID transfer (Input Report). Please see this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/24392/sending-multiple-characters-using-single-keystroke-in-hid-keyboard-example"&gt;post here&lt;/a&gt; for more information.&lt;/p&gt;
&lt;p&gt;I recommend you to open a new case for this project (HID keyboard + UART), since the original post was about which pins to use in UART communication.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART communication between nrf52 DK &amp; other microcontroller</title><link>https://devzone.nordicsemi.com/thread/153913?ContentTypeID=1</link><pubDate>Mon, 22 Oct 2018 18:20:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a7362e9-49db-4648-9d7a-026afd685420</guid><dc:creator>bscdb</dc:creator><description>&lt;p&gt;Hi msromero,&lt;/p&gt;
&lt;p&gt;Thank you for your reply. I&amp;#39;m trying to combine hid keyboard with .../peripheral/uart example. In&amp;nbsp;bsp_event_handler, which enum do I use to continuously send data received from uart (connected to microcontroller) instead of key presses? Note data needs to be sent only after bluetooth connection made. This data needs to be sent in input report. Should there be a time assigned to it similar to what is done in heart rate project. I was trying something as below-&lt;/p&gt;
&lt;p&gt;typedef struct&lt;br /&gt;{&lt;br /&gt; uint8_t arr;&lt;br /&gt;} arr_var;&lt;/p&gt;
&lt;p&gt;static arr_var arr_data;&lt;/p&gt;
&lt;p&gt;static uint32_t send_values()&lt;br /&gt;{&lt;br /&gt; uint32_t err_code;&lt;br /&gt; err_code = ble_hids_inp_rep_send(&amp;amp;m_hids, 0, 8, (unsigned char*)&amp;amp;arr_data, m_conn_handle);&lt;br /&gt; return err_code;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void Data_Init()&lt;br /&gt;{&lt;br /&gt; memset(&amp;amp;arr_data,0,sizeof(arr_data));&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;Inside bsp_event_handler-------&amp;gt;&lt;br /&gt;default:&lt;br /&gt; if (m_conn_handle != BLE_CONN_HANDLE_INVALID)&lt;br /&gt; { &lt;br /&gt; while (app_uart_get(&amp;amp;(arr_data.arr)) != NRF_SUCCESS);&lt;br /&gt; // while (app_uart_put(cr) != NRF_SUCCESS);&lt;br /&gt; if (arr_data.arr)// == &amp;#39;q&amp;#39; || cr == &amp;#39;Q&amp;#39;)&lt;br /&gt; { &lt;br /&gt; &lt;br /&gt; bsp_board_led_invert(4);&lt;br /&gt; nrf_delay_ms(500);&lt;br /&gt; }&lt;br /&gt; send_values();&lt;br /&gt; }&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;Is this correct?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART communication between nrf52 DK &amp; other microcontroller</title><link>https://devzone.nordicsemi.com/thread/153634?ContentTypeID=1</link><pubDate>Fri, 19 Oct 2018 12:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12032cc8-882f-4ddb-822b-641278a28c63</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi Sonal,&lt;/p&gt;
&lt;p&gt;This example does not use a softdevice since you are not sending data over BLE. The DK use pins 6 and 9 for RX and TX in UART, but you can use any GPIO pin for UART as long as the pin is not used by another peripheral already.&lt;/p&gt;
&lt;p&gt;Since pins 6 and 8 are routed to the interface MCU, I recommend you to configure other pins for UART, for instance pins 11 and 12, changing RX_PIN_NUMBER and TX_PIN_NUMBER in the SDK.&lt;/p&gt;
&lt;p&gt;You should also connect the other microcontroller to the same ground as your DK. You can see the nRF52 DK board connectors &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52/dita/nrf52/development/preview_dev_kit/images/PCA10036_board_connectors_v1.1.svg"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>