I am have programmed serial_lte_modem (ncs 2.1.0) to nrf9160DK with following configuration:
CONFIG_SLM_CONNECT_UART_2=y CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2 CONFIG_UART_2_NRF_HW_ASYNC=y CONFIG_SLM_WAKEUP_PIN=31 CONFIG_SLM_INDICATE_PIN=30
and overlay file:
&uart0 {
status = "okay";
};
&uart2 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
status = "okay";
hw-flow-control;
pinctrl-0 = <&uart2_default_alt>;
pinctrl-1 = <&uart2_sleep_alt>;
pinctrl-names = "default", "sleep";
};
&i2c2 {
status = "disabled";
};
&pinctrl {
uart2_default_alt: uart2_default_alt {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 10)>,
<NRF_PSEL(UART_RX, 0, 11)>,
<NRF_PSEL(UART_RTS, 0, 12)>,
<NRF_PSEL(UART_CTS, 0, 13)>;
};
};
uart2_sleep_alt: uart2_sleep_alt {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 10)>,
<NRF_PSEL(UART_RX, 0, 11)>,
<NRF_PSEL(UART_RTS, 0, 12)>,
<NRF_PSEL(UART_CTS, 0, 13)>;
low-power-enable;
};
};
};
Then I have connected my external nrf52840 p0.19 to nrf9160DK p0.10 and nrf52840 p0.20 to nrf9160DK p0.11.
Initialize UART on nrf52840:
void uart_init(void)
{
uint32_t err_code;
app_uart_comm_params_t const comm_params =
{
.rx_pin_no = 19,
.tx_pin_no = 20,
.rts_pin_no = NRF_UART_PSEL_DISCONNECTED,
.cts_pin_no = NRF_UART_PSEL_DISCONNECTED,
.flow_control = APP_UART_FLOW_CONTROL_DISABLED,
.use_parity = false,
.baud_rate = NRF_UART_BAUDRATE_115200
};
APP_UART_FIFO_INIT(&comm_params,
UART_RX_BUF_SIZE,
UART_TX_BUF_SIZE,
uart_event_handle,
APP_IRQ_PRIORITY_LOWEST,
err_code);
APP_ERROR_CHECK(err_code);
}
And send AT command:
int8_t send_at_command(char *at_command)
{
NRF_LOG_INFO("%s", at_command);
for (int i = 0; i < strlen(at_command); i++)
{
uint32_t retval = app_uart_put(at_command[i]);
if (retval != 0)
{
app_uart_flush();
return -1;
}
}
app_uart_put('\r');
app_uart_put('\n');
return 0;
}
After sending the AT command uart_event_handler interrupts with APP_UART_TX_EMPTY
Is there something wrong with my configuration? Any help is much appreciated.
