Skip to content

Commit 234b79a

Browse files
committed
applications: serial_lte_modem: Use downstream UART backend
Use downstream UART backend, which is optimized for use with SLM. Signed-off-by: Markus Lassila <[email protected]>
1 parent e612a11 commit 234b79a

File tree

6 files changed

+32
-20
lines changed

6 files changed

+32
-20
lines changed

applications/serial_lte_modem/overlay-cmux.conf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ CONFIG_SLM_SKIP_READY_MSG=y
1010
# Zephyr modem subsystem
1111
CONFIG_MODEM_MODULES=y
1212
CONFIG_MODEM_CMUX=y
13-
CONFIG_MODEM_BACKEND_UART=y
14-
CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=1000
13+
14+
# Enable SLM UART backend
15+
CONFIG_MODEM_BACKEND_UART=n
16+
CONFIG_MODEM_BACKEND_UART_ASYNC=n
17+
CONFIG_MODEM_BACKEND_UART_SLM=y
18+
CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS=1000
1519

1620
# debug options
1721
#CONFIG_MODEM_CMUX_LOG_LEVEL_DBG=y

applications/serial_lte_modem/overlay-ppp-cmux-linux.conf

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ CONFIG_SLM_CMUX=y
99
CONFIG_SLM_PPP=y
1010
CONFIG_SLM_CR_TERMINATION=y
1111

12-
# Assume at least baudrate 115200 for UART
13-
# so CMUX frame can be received in 12 ms (134*10/115200)
14-
CONFIG_MODEM_BACKEND_UART_ASYNC_RECEIVE_IDLE_TIMEOUT_MS=12
1512
CONFIG_MODEM_CMUX_MTU=127
1613
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE=536
1714
CONFIG_SLM_CMUX_UART_BUFFER_SIZE=6000
15+
16+
# Enable SLM UART backend
17+
CONFIG_MODEM_BACKEND_UART=n
18+
CONFIG_MODEM_BACKEND_UART_ASYNC=n
19+
CONFIG_MODEM_BACKEND_UART_SLM=y
20+
1821
# For sending full 6000 bytes at 115200 baudrate
1922
# 6000 * 10 / 115200 = 521 ms
20-
CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=521
21-
CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC=y
23+
CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS=521
24+
# Assume at least baudrate 115200 for UART
25+
# so CMUX frame can be received in 12 ms (134*10/115200)
26+
CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS=12
2227

2328
# These buffers are unused after AT#CMUX is enabled
2429
# so use minimal buffer size
@@ -43,7 +48,6 @@ CONFIG_NET_L2_PPP=y
4348
CONFIG_MODEM_MODULES=y
4449
CONFIG_MODEM_CMUX=y
4550
CONFIG_MODEM_PPP=y
46-
CONFIG_MODEM_BACKEND_UART=y
4751

4852
# L2 protocol
4953
CONFIG_NET_L2_PPP_MGMT=y

applications/serial_lte_modem/overlay-ppp.conf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ CONFIG_NET_NATIVE=y
2323
CONFIG_NET_L2_PPP=y
2424
CONFIG_MODEM_MODULES=y
2525
CONFIG_MODEM_PPP=y
26-
CONFIG_MODEM_BACKEND_UART=y
27-
CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=1000
28-
CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC=y
26+
27+
# Enable SLM UART backend
28+
CONFIG_MODEM_BACKEND_UART=n
29+
CONFIG_MODEM_BACKEND_UART_ASYNC=n
30+
CONFIG_MODEM_BACKEND_UART_SLM=y
31+
CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS=1000
2932

3033
# L2 protocol
3134
CONFIG_NET_L2_PPP_MGMT=y

applications/serial_lte_modem/src/slm_cmux.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#endif
1111
#include "slm_util.h"
1212
#include <zephyr/logging/log.h>
13-
#include <zephyr/modem/backend/uart.h>
13+
#include <zephyr/modem/backend/uart_slm.h>
1414
#include <zephyr/modem/cmux.h>
1515
#include <zephyr/modem/pipe.h>
1616
#include <assert.h>
@@ -35,7 +35,7 @@ static struct {
3535
/* UART backend */
3636
struct modem_pipe *uart_pipe;
3737
bool uart_pipe_open;
38-
struct modem_backend_uart uart_backend;
38+
struct modem_backend_uart_slm uart_backend;
3939
uint8_t uart_backend_receive_buf[CONFIG_SLM_CMUX_UART_BUFFER_SIZE]
4040
__aligned(sizeof(void *));
4141
uint8_t uart_backend_transmit_buf[CONFIG_SLM_CMUX_UART_BUFFER_SIZE];
@@ -348,15 +348,16 @@ static int cmux_start(void)
348348
}
349349

350350
{
351-
const struct modem_backend_uart_config uart_backend_config = {
351+
const struct modem_backend_uart_slm_config uart_backend_config = {
352352
.uart = DEVICE_DT_GET(DT_CHOSEN(ncs_slm_uart)),
353353
.receive_buf = cmux.uart_backend_receive_buf,
354354
.receive_buf_size = sizeof(cmux.uart_backend_receive_buf),
355355
.transmit_buf = cmux.uart_backend_transmit_buf,
356356
.transmit_buf_size = sizeof(cmux.uart_backend_transmit_buf),
357357
};
358358

359-
cmux.uart_pipe = modem_backend_uart_init(&cmux.uart_backend, &uart_backend_config);
359+
cmux.uart_pipe =
360+
modem_backend_uart_slm_init(&cmux.uart_backend, &uart_backend_config);
360361
if (!cmux.uart_pipe) {
361362
return -ENODEV;
362363
}

applications/serial_lte_modem/src/slm_ppp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <modem/lte_lc.h>
1515
#include <modem/pdn.h>
1616
#include <zephyr/modem/ppp.h>
17-
#include <zephyr/modem/backend/uart.h>
17+
#include <zephyr/modem/backend/uart_slm.h>
1818
#include <zephyr/net/ethernet.h>
1919
#include <zephyr/net/net_if.h>
2020
#include <zephyr/net/ppp.h>
@@ -594,20 +594,20 @@ int slm_ppp_init(void)
594594
}
595595

596596
{
597-
static struct modem_backend_uart ppp_uart_backend;
597+
static struct modem_backend_uart_slm ppp_uart_backend;
598598
static uint8_t ppp_uart_backend_receive_buf[sizeof(ppp_data_buf)]
599599
__aligned(sizeof(void *));
600600
static uint8_t ppp_uart_backend_transmit_buf[sizeof(ppp_data_buf)];
601601

602-
const struct modem_backend_uart_config uart_backend_config = {
602+
const struct modem_backend_uart_slm_config uart_backend_config = {
603603
.uart = ppp_uart_dev,
604604
.receive_buf = ppp_uart_backend_receive_buf,
605605
.receive_buf_size = sizeof(ppp_uart_backend_receive_buf),
606606
.transmit_buf = ppp_uart_backend_transmit_buf,
607607
.transmit_buf_size = sizeof(ppp_uart_backend_transmit_buf),
608608
};
609609

610-
ppp_pipe = modem_backend_uart_init(&ppp_uart_backend, &uart_backend_config);
610+
ppp_pipe = modem_backend_uart_slm_init(&ppp_uart_backend, &uart_backend_config);
611611
if (!ppp_pipe) {
612612
return -ENOSYS;
613613
}

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ manifest:
6565
# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html
6666
- name: zephyr
6767
repo-path: sdk-zephyr
68-
revision: 1e9016c290bc7e2e14445b77520fbab979f93e63
68+
revision: pull/3021/head
6969
import:
7070
# In addition to the zephyr repository itself, NCS also
7171
# imports the contents of zephyr/west.yml at the above

0 commit comments

Comments
 (0)