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:
CONFIG_SERIAL=y CONFIG_TRUSTED_EXECUTION_NONSECURE=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_MAIN_STACK_SIZE=4096
main.c:
#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");
uart_irq_callback_set(uart, uart_cb);
uart_irq_rx_enable(uart);
printk("UART loopback start!\n");
printk("u sucks\n");
printk("u sucks more\n");
while (1) {
k_cpu_idle();
}
}
The solution might be obvious as I am probably having a big case of tunnel visions.
Any suggestions?