Hello, guys!
I am using master branch of nRF Connect SDK and want to use UART_1 module of nRF9160 SiP to communicate with external devices.
I used nrf9160_pca10090ns.overlay file to re-define the &uart1 configuration (baud rate and pin position):
&uart1 {
status = "okay";
current-speed = <9600>;
tx-pin = <16>;
rx-pin = <17>;
rts-pin = <14>;
cts-pin = <15>;
};
I used GPIO pins 14, 15, 16, and 17 on P10 connector of nRF9160-DK board because they are not connected with anything on the board (just with nRF9160 SiP).
In addition to that, I included CONFIG_UART_1_NRF_UARTE=y in prj.conf file as suggested in this thread.
My main.c file looks like this:
/*
* Copyright (c) 2012-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <stdio.h>
#include <sys/printk.h>
#include <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_1");
uart_irq_callback_set(uart, uart_cb);
uart_irq_rx_enable(uart);
printk("UART loopback start!\n");
while (1) {
k_cpu_idle();
}
}
However, when I compile the project, there is an issue with the line #include <uart.h>. Compiler says there is no such a file or directory!
How we should include uart.h in the master branch of nRF Connect SDK, where this file is located?
I spotted some uart.h files within build/zephyr/include/generated/syscalls and tried to include it with #include <syscalls/uart.h>. However, a bunch of other warnings and errors were reported by the compiler.
Thank you for your time and efforts.
Sincerely,
Bojan.