Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions app/overlay-cmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ CONFIG_SM_SKIP_READY_MSG=y
CONFIG_MODEM_MODULES=y
CONFIG_MODEM_CMUX=y

# Enable Serial Modem UART backend
CONFIG_MODEM_BACKEND_UART=n
CONFIG_MODEM_BACKEND_UART_ASYNC=n
CONFIG_MODEM_BACKEND_UART_SLM=y
CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS=1000

# These buffers are unused after AT#CMUX is enabled
# so use minimal buffer size
CONFIG_SM_UART_RX_BUF_COUNT=2
CONFIG_SM_UART_RX_BUF_SIZE=128
CONFIG_SM_UART_TX_BUF_SIZE=128

# debug options
#CONFIG_MODEM_CMUX_LOG_LEVEL_DBG=y
#CONFIG_MODEM_MODULES_LOG_LEVEL_DBG=y
23 changes: 5 additions & 18 deletions app/overlay-ppp-cmux-linux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,12 @@ CONFIG_SM_CR_TERMINATION=y

CONFIG_MODEM_CMUX_MTU=127
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE=536
CONFIG_SM_CMUX_UART_BUFFER_SIZE=600

# Enable Serial Modem UART backend
CONFIG_MODEM_BACKEND_UART=n
CONFIG_MODEM_BACKEND_UART_ASYNC=n
CONFIG_MODEM_BACKEND_UART_SLM=y

# For sending full 600 bytes at 115200 baudrate
# 600 * 10 / 115200 = 52.1 ms
CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS=53
# Assume at least baudrate 115200 for UART
# so CMUX frame can be received in 12 ms (134*10/115200)
CONFIG_MODEM_BACKEND_UART_SLM_RECEIVE_IDLE_TIMEOUT_MS=12

# These buffers are unused after AT#CMUX is enabled
# so use minimal buffer size
CONFIG_SM_UART_RX_BUF_COUNT=2
CONFIG_SM_UART_RX_BUF_SIZE=128
CONFIG_SM_UART_TX_BUF_SIZE=128
# With CMUX, the UART buffers should be at least the size of the
# CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE
CONFIG_SM_UART_RX_BUF_COUNT=3
CONFIG_SM_UART_RX_BUF_SIZE=256
CONFIG_SM_UART_TX_BUF_SIZE=768

# When using PPP, disable commands of IP-based protocols to save flash space.
CONFIG_SM_FTPC=n
Expand Down
8 changes: 8 additions & 0 deletions app/overlay-ppp-without-cmux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable modem UART backend
CONFIG_MODEM_BACKEND_UART=y
CONFIG_MODEM_BACKEND_UART_ASYNC=y
6 changes: 0 additions & 6 deletions app/overlay-ppp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ CONFIG_NET_L2_PPP=y
CONFIG_MODEM_MODULES=y
CONFIG_MODEM_PPP=y

# Enable Serial Modem UART backend
CONFIG_MODEM_BACKEND_UART=n
CONFIG_MODEM_BACKEND_UART_ASYNC=n
CONFIG_MODEM_BACKEND_UART_SLM=y
CONFIG_MODEM_BACKEND_UART_SLM_TRANSMIT_TIMEOUT_MS=1000

# L2 protocol
CONFIG_NET_L2_PPP_MGMT=y
CONFIG_NET_L2_PPP_OPTION_MRU=y
Expand Down
1 change: 1 addition & 0 deletions app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ CONFIG_SM_EXTERNAL_XTAL=n
#CONFIG_SM_LOG_LEVEL_DBG=y
#CONFIG_LOG_PRINTK=n
#CONFIG_LOG_MODE_IMMEDIATE=y
#CONFIG_DEBUG_OPTIMIZATIONS=y

# For using external GNSS antenna
#CONFIG_MODEM_ANTENNA=y
Expand Down
2 changes: 2 additions & 0 deletions app/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ tests:
build_only: true
extra_args:
- EXTRA_CONF_FILE="overlay-ppp.conf"
- EXTRA_CONF_FILE="overlay-ppp-without-cmux.conf"
- EXTRA_DTC_OVERLAY_FILE="overlay-ppp-without-cmux.overlay"
platform_allow:
- nrf9160dk/nrf9160/ns
Expand All @@ -104,6 +105,7 @@ tests:
build_only: true
extra_args:
- EXTRA_CONF_FILE="overlay-ppp.conf"
- EXTRA_CONF_FILE="overlay-ppp-without-cmux.conf"
- EXTRA_DTC_OVERLAY_FILE="overlay-ppp-without-cmux.overlay"
extra_configs:
- CONFIG_SM_POWER_PIN=31
Expand Down
63 changes: 33 additions & 30 deletions app/src/sm_at_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,34 +383,34 @@ int sm_at_init(void)

err = sm_at_tcp_proxy_init();
if (err) {
LOG_ERR("TCP Server could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "TCP Server", err);
return -EFAULT;
}
err = sm_at_udp_proxy_init();
if (err) {
LOG_ERR("UDP Server could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "UDP Server", err);
return -EFAULT;
}
err = sm_at_socket_init();
if (err) {
LOG_ERR("TCPIP could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "Socket", err);
return -EFAULT;
}
err = sm_at_icmp_init();
if (err) {
LOG_ERR("ICMP could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "ICMP", err);
return -EFAULT;
}
#if defined(CONFIG_SM_SMS)
err = sm_at_sms_init();
if (err) {
LOG_ERR("SMS could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "SMS", err);
return -EFAULT;
}
#endif
err = sm_at_fota_init();
if (err) {
LOG_ERR("FOTA could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "FOTA", err);
return -EFAULT;
}
#if defined(CONFIG_SM_NRF_CLOUD)
Expand All @@ -419,63 +419,63 @@ int sm_at_init(void)
/* Allow nRF Cloud initialization to fail as sometimes JWT is missing
* especially during development.
*/
LOG_ERR("nRF Cloud could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "nRF Cloud", err);
err = 0;
}
#endif
#if defined(CONFIG_SM_GNSS)
err = sm_at_gnss_init();
if (err) {
LOG_ERR("GNSS could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "GNSS", err);
return -EFAULT;
}
#endif
#if defined(CONFIG_SM_FTPC)
err = sm_at_ftp_init();
if (err) {
LOG_ERR("FTP could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "FTP", err);
return -EFAULT;
}
#endif
#if defined(CONFIG_SM_MQTTC)
err = sm_at_mqtt_init();
if (err) {
LOG_ERR("MQTT could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "MQTT", err);
return -EFAULT;
}
#endif
#if defined(CONFIG_SM_HTTPC)
err = sm_at_httpc_init();
if (err) {
LOG_ERR("HTTP could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "HTTP", err);
return -EFAULT;
}
#endif
#if defined(CONFIG_SM_GPIO)
err = sm_at_gpio_init();
if (err) {
LOG_ERR("GPIO could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "GPIO", err);
return -EFAULT;
}
#endif
#if defined(CONFIG_SM_TWI)
err = sm_at_twi_init();
if (err) {
LOG_ERR("TWI could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "TWI", err);
return -EFAULT;
}
#endif
#if defined(CONFIG_SM_CARRIER)
err = sm_at_carrier_init();
if (err) {
LOG_ERR("LwM2M carrier could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "LwM2M carrier", err);
return -EFAULT;
}
#endif
#if defined(CONFIG_LWM2M_CARRIER_SETTINGS)
err = sm_at_carrier_cfg_init();
if (err) {
LOG_ERR("LwM2M carrier could not be initialized: %d", err);
LOG_ERR("%s initialization failed (%d).", "LwM2M carrier", err);
return -EFAULT;
}
#endif
Expand All @@ -485,7 +485,7 @@ int sm_at_init(void)
#if defined(CONFIG_SM_PPP)
err = sm_ppp_init();
if (err) {
LOG_ERR("PPP initialization failed. (%d)", err);
LOG_ERR("%s initialization failed (%d).", "PPP", err);
return err;
}
#endif
Expand All @@ -498,76 +498,79 @@ void sm_at_uninit(void)

err = sm_at_tcp_proxy_uninit();
if (err) {
LOG_WRN("TCP Server could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "TCP Server", err);
}
err = sm_at_udp_proxy_uninit();
if (err) {
LOG_WRN("UDP Server could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "UDP Server", err);
}
err = sm_at_socket_uninit();
if (err) {
LOG_WRN("TCPIP could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "Socket", err);
}
err = sm_at_icmp_uninit();
if (err) {
LOG_WRN("ICMP could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "ICMP", err);
}
#if defined(CONFIG_SM_SMS)
err = sm_at_sms_uninit();
if (err) {
LOG_WRN("SMS could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "SMS", err);
}
#endif
err = sm_at_fota_uninit();
if (err) {
LOG_WRN("FOTA could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "FOTA", err);
}
#if defined(CONFIG_SM_NRF_CLOUD)
err = sm_at_nrfcloud_uninit();
if (err) {
LOG_WRN("nRF Cloud could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "nRF Cloud", err);
}
#endif
#if defined(CONFIG_SM_GNSS)
err = sm_at_gnss_uninit();
if (err) {
LOG_WRN("GNSS could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "GNSS", err);
}
#endif
#if defined(CONFIG_SM_FTPC)
err = sm_at_ftp_uninit();
if (err) {
LOG_WRN("FTP could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "FTP", err);
}
#endif
#if defined(CONFIG_SM_MQTTC)
err = sm_at_mqtt_uninit();
if (err) {
LOG_WRN("MQTT could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "MQTT", err);
}
#endif
#if defined(CONFIG_SM_HTTPC)
err = sm_at_httpc_uninit();
if (err) {
LOG_WRN("HTTP could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "HTTP", err);
}
#endif
#if defined(CONFIG_SM_TWI)
err = sm_at_twi_uninit();
if (err) {
LOG_ERR("TWI could not be uninit: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "TWI", err);
}
#endif
#if defined(CONFIG_SM_GPIO)
err = sm_at_gpio_uninit();
if (err) {
LOG_ERR("GPIO could not be uninit: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "GPIO", err);
}
#endif
#if defined(CONFIG_SM_CARRIER)
err = sm_at_carrier_uninit();
if (err) {
LOG_ERR("LwM2M carrier could not be uninitialized: %d", err);
LOG_WRN("%s uninitialization failed (%d).", "LwM2M carrier", err);
}
#endif
#if defined(CONFIG_SM_CMUX)
sm_cmux_uninit();
#endif
}
Loading