NRF9160 DK failed to add another UART to BLE NUS example

Hello,

I am currently working on a project using the NRF9160DK and I am encountering an issue when trying to add another UART (UART3) to the BLE NUS example.

I have successfully managed to use the hci_lpuart for BLE communication and can run the BLE NUS sample. However, for my use case, I need to add UART3 to my project.

The problem arises when initializing UART3 and trying to assign a callback function for it. I receive the following error on RTT: <err> peripheral_uart: Cannot initialize UART callback.

Here is my overlay:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <nrf9160dk_nrf52840_reset_on_if5.dtsi>
/ {
chosen {
nordic,nus-uart = &uart0;
zephyr,bt-uart=&lpuart;
};
compatible = "nordic,nrf9160-dk-nrf9160";
model = "Nordic nRF9160 DK NRF9160";
};
&gpiote {
interrupts = <49 NRF_DEFAULT_IRQ_PRIORITY>;
};
&uart2 {
current-speed = <230400>;
status = "okay";
/delete-property/ hw-flow-control;
pinctrl-0 = <&uart2_default_alt>;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

And relevant code for uart3 initialization:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));
static const struct device *livecon_uart = DEVICE_DT_GET(DT_NODELABEL(uart3));
void uart_cb_2(const struct device *dev, struct uart_event *evt, void *user_data)
{
switch (evt->type) {
case UART_RX_RDY:
break;
case UART_RX_BUF_REQUEST:
// printk("RX_BUF_REQUEST\n");
break;
case UART_RX_DISABLED:
break;
default:
break;
}
}
static int livecon_uart_init(void)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Any guidance on how to resolve this issue would be greatly appreciated.

Thank you in advance for your help.

Best regards, Vincent