<?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 does not send data in nRF9160.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47392/uart-does-not-send-data-in-nrf9160</link><description>I want to use UART. 
 I checked the waveform and UART does not send data. Here is my code. build and run are successful. Any help? I connect UART RX and TX directly, which means p16 and p15 are connected by a jumper. 
 SEGGER IDE V4.16 nrf version: v0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 18 May 2019 08:52:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47392/uart-does-not-send-data-in-nrf9160" /><item><title>RE: UART does not send data in nRF9160.</title><link>https://devzone.nordicsemi.com/thread/187716?ContentTypeID=1</link><pubDate>Sat, 18 May 2019 08:52:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4815750-20ad-43dd-9d01-3f75163fcbb5</guid><dc:creator>Yusuke</dc:creator><description>&lt;p&gt;This works!&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;misc/printk.h&amp;gt;
#include &amp;lt;uart.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

/* nRF9160 DK voltage = 3.0V 
 * non sucure
 * board name: nrf9160_pca10090ns
 * nrf9160_pca10090ns.overlay */

static u8_t uart_buf[1024];
static K_FIFO_DEFINE(fifo_uart_tx_data);
static K_FIFO_DEFINE(fifo_uart_rx_data);

/********************************************/
void uart_wifi_cb(struct device *x)
{
    printk(&amp;quot;uart_wifi_cb\n&amp;quot;);
	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\n&amp;quot;, uart_buf);
}

void main (void)
{
        struct device *uart_wifi= device_get_binding(&amp;quot;UART_1&amp;quot;);
        uart_irq_callback_set(uart_wifi, uart_wifi_cb);
        uart_irq_rx_enable(uart_wifi); 

	while (1) {
	    printk(&amp;quot;testing...\n&amp;quot;);
        uart_fifo_fill(uart_wifi, &amp;quot;AT\r&amp;quot; ,sizeof(&amp;quot;AT\r&amp;quot;));
        k_sleep(2000);
                
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Btw, uart_wifi_cb receives only one character every callback like below. I want a whole characters in one callback. How can I do that?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;***** Booting Zephyr OS v1.14.99-ncs1 *****
testing...
uart_wifi_cb
A
uart_wifi_cb
T
uart_wifi_cb

uart_wifi_cb

testing...
uart_wifi_cb
A
uart_wifi_cb
T
uart_wifi_cb

uart_wifi_cb

testing...
uart_wifi_cb
A
uart_wifi_cb
T
uart_wifi_cb

uart_wifi_cb

&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART does not send data in nRF9160.</title><link>https://devzone.nordicsemi.com/thread/187585?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 16:49:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec0a4830-28f8-431a-ab27-75a71762bb1c</guid><dc:creator>Yusuke</dc:creator><description>&lt;p&gt;Thank you for your reply!&lt;/p&gt;
&lt;p&gt;I tested it&amp;nbsp; but it doesn&amp;#39;t release data through UART. I checked the waveform.&lt;/p&gt;
&lt;p&gt;This is result. Do you have any advice?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Peripheral              Domain          Status
00 NRF_P0               Non-Secure      OK
01 NRF_CLOCK            Non-Secure      OK
02 NRF_RTC1             Non-Secure      OK
03 NRF_NVMC             Non-Secure      OK
04 NRF_UARTE1           Non-Secure      OK
05 NRF_UARTE2           Secure          SKIP
06 NRF_IPC              Non-Secure      OK
07 NRF_VMC              Non-Secure      OK
08 NRF_FPU              Non-Secure      OK
09 NRF_EGU1             Non-Secure      OK
10 NRF_EGU2             Non-Secure      OK
11 NRF_TWIM2            Non-Secure      OK
12 NRF_SPIM3            Non-Secure      OK
13 NRF_TIMER0           Non-Secure      OK
14 NRF_TIMER1           Non-Secure      OK
15 NRF_TIMER2           Non-Secure      OK
16 NRF_SAADC            Non-Secure      OK
17 NRF_GPIOTE1          Non-Secure      OK

SPM: NS image at 0x8000
SPM: NS MSP at 0x200209a8
SPM: NS reset vector at 0x90f1
SPM: prepare to jump to Non-Secure image.
***** Booting Zephyr OS v1.14.99-ncs1 *****
testing...
testing...
testing...
testing...&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART does not send data in nRF9160.</title><link>https://devzone.nordicsemi.com/thread/187582?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 16:27:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:322ed5d7-f75a-4f80-88cf-a20cb4599b85</guid><dc:creator>Hoang</dc:creator><description>&lt;p&gt;Hi yusuke,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you try:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static u8_t uart_buf[1024];
static K_FIFO_DEFINE(fifo_uart_tx_data);
static K_FIFO_DEFINE(fifo_uart_rx_data);
struct uart_data_t {
	void  *fifo_reserved;
	u8_t    data[1024];
	u16_t   len;
};

/********************************************/
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 *uart_send= device_get_binding(&amp;quot;UART_1&amp;quot;);
        uart_irq_callback_set(uart_send, uart_cb);
	    
        
        
        

	while (1) {
	    
	    printk(&amp;quot;testing...\n&amp;quot;); 
		           
        uart_fifo_fill(uart_send, &amp;quot;AT\r&amp;quot; ,sizeof(&amp;quot;AT\r&amp;quot;));
        k_sleep(2000);
                
	}
     
	
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>