<?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>nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44788/nrf9160-dk-send-receive-data-from-uart1</link><description>Dear, 
 
 I am using nRF9160 DK, 
 I can re-define pin for UART0 and UART1, from UART0, i can receive data from UART0/UART1. 
 
 Now, I want to send data to UART1. 
 
 Plz help me 
 Regards, 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 06 Oct 2020 14:16:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44788/nrf9160-dk-send-receive-data-from-uart1" /><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/273276?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 14:16:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f8e91ed-08a9-428d-bfaf-60f60566cfa5</guid><dc:creator>Adeel</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Anyone to reply on this thread as its useful for me. In line 24 of the above code, I get error on: &amp;amp;fifo_uart_tx_data as undeclared. I could not find it in the drivers/uart.h library of uart.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any way to fix this error ?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Adeel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/187578?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 16:09:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e164462-3fba-4cb1-835d-4bde385aae08</guid><dc:creator>Hoang</dc:creator><description>&lt;p&gt;Hi Moshe,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry, I didnt add the library in my code,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You need to add:&lt;/p&gt;
&lt;p&gt;#include &amp;lt;zephyr.h&amp;gt;&lt;br /&gt;#include &amp;lt;misc/printk.h&amp;gt;&lt;br /&gt;#include &amp;lt;uart.h&amp;gt;&lt;/p&gt;
&lt;p&gt;the function&amp;nbsp;&lt;span&gt;fifo_uart_tx_data is defined in uart.h lib&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Goodluck&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/187479?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 09:46:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb935ce2-e2a6-407e-b830-87d982f702d9</guid><dc:creator>MosheSmartAmr</dc:creator><description>&lt;p&gt;HI hoang,&lt;br /&gt;I&amp;#39;m practically trying to do the same thing.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I did not understand what is this fifo&amp;nbsp;fifo_uart_tx_data,&lt;/p&gt;
&lt;p&gt;did you create it ? (trying this code i get fifo_uart_tx_data undeclared error)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/179652?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2019 06:47:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7efd87f8-1b9e-48f0-97c0-b6a6ac9da9ba</guid><dc:creator>Hoang</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I just tried:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void uart_sendCOM(struct device *x,  u8_t *Cont)
{
	       
         u16_t len = strlen(Cont); 
         uart_fifo_fill(x, Cont,len );
         uart_irq_tx_enable(x);
         
    
}
void uart_cb(struct device *x)
{
	uart_irq_update(x);
	int data_length = 0;

	if (uart_irq_rx_ready(x)) {
                data_length = uart_fifo_read(x, uart_buf, sizeof(uart_buf));
		uart_buf[data_length] = 0;
	}
	printk(&amp;quot;%s&amp;quot;, uart_buf);

       	if (uart_irq_tx_ready(x)) {
               
        	struct uart_data_t *buf =
			k_fifo_get(&amp;amp;fifo_uart_tx_data, K_NO_WAIT);
		u16_t written = 0;

		/* Nothing in the FIFO, nothing to send */
		if (!buf) {
			uart_irq_tx_disable(x);
			return;
		}

		while (buf-&amp;gt;len &amp;gt; written) {
			written += uart_fifo_fill(x,
						  &amp;amp;buf-&amp;gt;data[written],
						  buf-&amp;gt;len - written);
		}

		while (!uart_irq_tx_complete(x)) {
			/* Wait for the last byte to get
			 * shifted out of the module
			 */
		}

		if (k_fifo_is_empty(&amp;amp;fifo_uart_tx_data)) {
			uart_irq_tx_disable(x);
		}

		k_free(buf);
	
		
	}

       
}

void main(void)
{
	
        struct device *uart1 = device_get_binding(&amp;quot;UART_1&amp;quot;);
       
        uart_irq_rx_enable(uart1);
        uart_irq_callback_set(uart1, uart_cb);
        uart_sendCOM(uart1, &amp;quot;Hello the world!&amp;quot;);
        k_sleep(3000);
        
}
        &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hope it is correct!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Regards,&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/179149?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 09:00:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5ca7874-42d4-490d-8b12-d6a4db29d2d5</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Hng,&lt;br /&gt;I am sorry you feel that way,&amp;nbsp;it is my fault for misunderstanding.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It would be fantastic if you could share with&amp;nbsp;the&amp;nbsp;community&amp;nbsp;the&amp;nbsp;solution to your issue (?)&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f604.svg" title="Smile"&gt;&amp;#x1f604;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Martin L.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/179034?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 16:39:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1af894e9-948a-48c7-bbfb-73d06c8517fc</guid><dc:creator>Hoang</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;so sorry for confusing questions.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I just want to send/recive on UART1. And I mean uart_cb()&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i found the solution for me.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I really unhappy with support from nordic, it takes too long time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Anyway, thanks so much, I&amp;rsquo;m really appreciate your support.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;hng&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/178993?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 14:53:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:733b869c-b2c0-4dc9-9640-4cedc800c879</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Hoang,&lt;/p&gt;
&lt;p&gt;From the other thread it seemed like you found a solution.&lt;/p&gt;
&lt;p&gt;Anyway, I am a little unsure what you mean with your question.&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/45476/connecting-uart1-to-a-periph-on-nrf9160-dk" rel="noopener noreferrer" target="_blank"&gt;Maybe this thread can be helpful.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/176329?ContentTypeID=1</link><pubDate>Fri, 15 Mar 2019 06:34:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12438794-0a83-4f5a-9cc4-cb761c3dfa72</guid><dc:creator>Hoang</dc:creator><description>&lt;p&gt;Dear Martin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your short answer, but I couldn&amp;#39;t&amp;nbsp;solve my problem.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;UART0 is using for debug (printk())&lt;/p&gt;
&lt;p&gt;I want to use UART1 to communicate with another sensor.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;with uart_cd() I can read data from UART0/UART1, I want to send data to UART1&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK send/receive data from UART1</title><link>https://devzone.nordicsemi.com/thread/176223?ContentTypeID=1</link><pubDate>Thu, 14 Mar 2019 13:57:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6931ad3-bf9d-4232-af73-dfea7534f7b4</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/44470/nrf9160-dk-gpio-uart"&gt;Duplicate&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>