This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART example acting weird

Hi! 

I've been playing around with the SDK and nrf9160 dk for a week now, and it's a lot of fun. 

In the beginning the UART example worked perfectly, and I managed to add a second UART which also worked. Now, after playing around with mqtt, trying to merge some of the projects etc. it seems something broke. 

When i try to run the UART feedback example (using printk with LTE link monitor), it doesn't work. The monitor shows: "UART feedback loop" as supposed, but nothing can be written to it.

When running the "at_client" example, I can write as many commands as I'd like (at least after restarting the monitor if UART example was previously tried).

Any suggestions?

My prj.conf:

Fullscreen
1
2
3
4
CONFIG_SERIAL=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_MAIN_STACK_SIZE=4096
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

main.c: 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <zephyr.h>
#include <sys/printk.h>
#include <drivers/uart.h>
static u8_t uart_buf[1024];
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("%s", uart_buf);
}
void main(void)
{
struct device *uart = device_get_binding("UART_0");
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The solution might be obvious as I am probably having a big case of tunnel visions.

Any suggestions?