Debug error on Build and debug Uart from sample using nrf9160, using segger?

Good morning Sir/Mam

i want to read data on serial using nrf9160 by segger. i have pic a sample from devzone "Uart". i have successfully build it and Run on board , but want to go with build and debug .

on starting debugging  debug stop with following error.

code is.

#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/uart.h>

static uint8_t uart_buf[1024];

void uart_cb(const struct device *x, void *user_data)
{
	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;
	}
    uart_fifo_fill(x, uart_buf, data_length);
}

void main(void)
{

    const struct device *uart = device_get_binding("UART_2");
	uart_irq_callback_set(uart, uart_cb);
	uart_irq_rx_enable(uart);
	uart_fifo_fill(uart, "UART loopback start!\r\n", 22);
	printk("UART loopback start!\n"); //output on UART0, which is default for logging
	while (1) {printk("UART loopback start!\n"); //output on UART0, which is default for logging
		k_cpu_idle();
	}
}

please help  

Parents Reply Children
Related