Hi,
I am using the uart example from https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/uart/src/main.c
I want to read serial data from another microcontroller through UART0 on nRF9160DK
I am connecting RX - P0.29 and TX P0.28
Moreover I have also added nrf9160dk_nrf9160ns.overlay and prj.conf files
nrf9160dk_nrf9160ns.overlay
&uart0 { current-speed = <115200>; status = "okay"; tx-pin = <28>; rx-pin = <29>; rts-pin = <0xFFFFFFFF>; cts-pin = <0xFFFFFFFF>; };
prj
CONFIG_SERIAL=y CONFIG_TRUSTED_EXECUTION_NONSECURE=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_BSD_LIBRARY_TRACE_ENABLED=n CONFIG_MAIN_STACK_SIZE=4096
main
/* * * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr.h> //#include <misc/printk.h> //#include <logging/log.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("UART0 loopback start!\n"); while (1) { k_cpu_idle(); } }
I cannot see anything on the terminal window even though I am sending data continuously
Please guide me through the same and let me know the necessary steps