<?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 serial send - recieve buffer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55685/nrf9160-dk-serial-send---recieve-buffer</link><description>Hello guys, 
 I wan`t to make an project that send trough serial port a new image to flash my nrf9160. 
 By the moment I managed to send and recieve data but only on uart0. 
 So if someone could explain me a little more what is hapening and how can i</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 Dec 2019 12:45:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55685/nrf9160-dk-serial-send---recieve-buffer" /><item><title>RE: nrf9160 DK serial send - recieve buffer</title><link>https://devzone.nordicsemi.com/thread/225872?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 12:45:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe3002f7-23e9-44b3-be41-ed9028b4dba4</guid><dc:creator>Adev</dc:creator><description>&lt;p&gt;Hi, thank you for help, i managed to make it work now :) the problem was in my python script i was using for serial communication.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Cojocari Adrian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 DK serial send - recieve buffer</title><link>https://devzone.nordicsemi.com/thread/225871?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 12:43:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4dac218-8eec-4cd4-a041-c9375a5cf375</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi! Could you send me your prj.conf file, thanks!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 DK serial send - recieve buffer</title><link>https://devzone.nordicsemi.com/thread/225857?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 11:39:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d56efa2a-15ab-47db-9061-035b2556859e</guid><dc:creator>Adev</dc:creator><description>&lt;p&gt;I tried another, more simple aproach :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;void uart_sendCOM(struct device *x)&lt;/strong&gt;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp;k_sleep(1000);&lt;br /&gt;&amp;nbsp; &amp;nbsp;uart_fifo_fill(x, &amp;quot;test\r&amp;quot;, strlen(&amp;quot;test\r&amp;quot;));&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;static void uart_cb(struct device *x)&lt;/strong&gt;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; int data_length = 0;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uart_irq_update(x);&lt;/p&gt;
&lt;p&gt;if (uart_irq_rx_ready(x))&lt;br /&gt;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;data_length = uart_fifo_read(x, &amp;amp;uart_buf[uart_buff_len], sizeof(uart_buf));&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;uart_buff_len += data_length;&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;if (uart_buff_len == UART_BUFF_MAX_SIZE || uart_buf[uart_buff_len - 1] == &amp;#39;\n&amp;#39; || uart_buf[uart_buff_len - 1] == &amp;#39;\r&amp;#39;)&lt;br /&gt;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; uart_buff_len = 0;&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In main() I have :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;uart = device_get_binding(&amp;quot;UART_0&amp;quot;);&lt;br /&gt; if (!uart)&lt;br /&gt; {&lt;br /&gt; printk(&amp;quot;Herror\r\n&amp;quot;); // error happens.&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;uart_irq_callback_set(uart, uart_cb);&lt;br /&gt; uart_irq_rx_enable(uart);&lt;br /&gt; printk(&amp;quot;UART loopback start!\n&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The problem is that recieve works good, but send part is not working...&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>