Skip to content

Commit bccf184

Browse files
MarkusLassilanordicjm
authored andcommitted
lib: modem_slm: Refactor UART implementation.
Rewrite of the previously unstable (freezes & lost data) UART implementation between host device, which is using modem_slm lib, and device with SLM. Removed: - CONFIG_MODEM_SLM_DMA_MAXLEN (RX buf size) - modem_slm_reset_uart as there is no reason to reset UART. Added Kconfigs for UART buffers: - CONFIG_MODEM_SLM_UART_RX_BUF_COUNT - CONFIG_MODEM_SLM_UART_RX_BUF_SIZE - CONFIG_MODEM_SLM_UART_TX_BUF_SIZE Added Kconfig for buffering AT-responses: - CONFIG_MODEM_SLM_AT_CMD_RESP_MAX_SIZE Signed-off-by: Markus Lassila <[email protected]>
1 parent 7ba47ec commit bccf184

File tree

6 files changed

+395
-198
lines changed

6 files changed

+395
-198
lines changed

doc/nrf/libraries/modem/modem_slm.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,21 @@ The library is enabled and configured entirely using the Kconfig system.
3232
Configure the following Kconfig options to enable this library:
3333

3434
* :kconfig:option:`CONFIG_MODEM_SLM` - Enables the Modem SLM library.
35-
* :kconfig:option:`CONFIG_MODEM_SLM_DMA_MAXLEN` - Configures UART RX EasyDMA buffer size, which is configured to 1024 bytes by default.
35+
* :kconfig:option:`CONFIG_MODEM_SLM_AT_CMD_RESP_MAX_SIZE` - Configures the size of the AT command response buffer.
36+
The default size is 2100 bytes, which is aligned with SLM.
3637
* :kconfig:option:`CONFIG_MODEM_SLM_POWER_PIN` - Configures the mandatory power pin GPIO, which is not configured by default.
3738
* :kconfig:option:`CONFIG_MODEM_SLM_POWER_PIN_TIME` - Sets the toggle time value in milliseconds for power pin GPIO, by default 100 ms.
3839

3940
Optionally configure the following Kconfig options based on need:
4041

4142
* :kconfig:option:`CONFIG_MODEM_SLM_SHELL` - Enables the shell function in the Modem SLM library, which is not enabled by default.
4243
* :kconfig:option:`CONFIG_MODEM_SLM_INDICATE_PIN` - Configures the optional indicator GPIO, which is not configured by default.
44+
* :kconfig:option:`CONFIG_MODEM_SLM_UART_RX_BUF_COUNT` - Configures the number of RX buffers for the UART device.
45+
The default value is 3.
46+
* :kconfig:option:`CONFIG_MODEM_SLM_UART_RX_BUF_SIZE` - Configures the size of the RX buffer for the UART device.
47+
The default value is 256 bytes.
48+
* :kconfig:option:`CONFIG_MODEM_SLM_UART_TX_BUF_SIZE` - Configures the size of the TX buffer for the UART device.
49+
The default value is 256 bytes.
4350

4451
The application must use Zephyr ``chosen`` nodes in devicetree to select UART device.
4552
Additionally, GPIO can also be selected.
@@ -116,8 +123,6 @@ The SLM Monitor has similar functions to the :ref:`at_monitor_readme` library, e
116123
117124
SLM_MONITOR(network, "\r\n+CEREG:", cereg_mon);
118125
119-
SLM_MONITOR(download, "\r\n#XDFUGET: 0,", download_mon, MON_PAUSED);
120-
121126
API documentation
122127
*****************
123128

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,23 @@ Modem libraries
459459
Even within the same network, the PDN connection establishment method (PCO vs ePCO) might change when the device operates in NB-IoT or LTE Cat-M1, resulting in missing DNS addresses when one method is used, but not the other.
460460
Having a fallback DNS address ensures that the device always has a DNS to fallback to.
461461

462+
* :ref:`lib_modem_slm` library:
463+
464+
* Added:
465+
466+
* The :kconfig:option:`CONFIG_MODEM_SLM_UART_RX_BUF_COUNT` Kconfig option for configuring RX buffer count.
467+
* The :kconfig:option:`CONFIG_MODEM_SLM_UART_RX_BUF_SIZE` Kconfig option for configuring RX buffer size.
468+
* The :kconfig:option:`CONFIG_MODEM_SLM_UART_TX_BUF_SIZE` Kconfig option for configuring TX buffer size.
469+
* The :kconfig:option:`CONFIG_MODEM_SLM_AT_CMD_RESP_MAX_SIZE` Kconfig option for buffering AT command responses.
470+
471+
* Updated the UART implementation between the host device, using the :ref:`lib_modem_slm` library, and the device running the :ref:`Serial LTE Modem <slm_description>` application.
472+
473+
* Removed:
474+
475+
* The ``CONFIG_MODEM_SLM_DMA_MAXLEN`` Kconfig option.
476+
Use :kconfig:option:`CONFIG_MODEM_SLM_UART_RX_BUF_SIZE` instead.
477+
* The ``modem_slm_reset_uart`` function as there is no longer need to reset the UART.
478+
462479
Multiprotocol Service Layer libraries
463480
-------------------------------------
464481

include/modem/modem_slm.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ int modem_slm_register_ind(slm_ind_handler_t handler, bool wakeup);
9898
*/
9999
int modem_slm_power_pin_toggle(void);
100100

101-
/**
102-
* @brief Reset the RX function of the serial interface
103-
*
104-
*/
105-
void modem_slm_reset_uart(void);
106-
107101
/**
108102
* @brief Function to send an AT command in SLM command mode
109103
*

lib/modem_slm/Kconfig

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,42 @@ menuconfig MODEM_SLM
99
depends on UART_ASYNC_API
1010
depends on RING_BUFFER
1111
select EXPERIMENTAL
12+
select UART_USE_RUNTIME_CONFIGURE
1213
bool "Modem SLM Library for MCU [EXPERIMENTAL]"
1314

1415
if MODEM_SLM
1516

16-
config MODEM_SLM_DMA_MAXLEN
17-
int "Buffer size for UART RX EasyDMA"
18-
range 256 2048
19-
default 1024
17+
#
18+
# UART buffers
19+
#
20+
config MODEM_SLM_UART_RX_BUF_COUNT
21+
int "Receive buffers for UART"
22+
range 2 4
23+
default 3
24+
help
25+
Number of buffers for receiving (RX) UART traffic.
26+
If the buffers are full, UART RX will be disabled until the buffers are processed.
27+
28+
config MODEM_SLM_UART_RX_BUF_SIZE
29+
int "Receive buffer size for UART"
30+
range 16 4096
31+
default 256
32+
help
33+
Amount of received (RX), unprocessed, UART traffic that can be held by a single buffer.
34+
35+
config MODEM_SLM_UART_TX_BUF_SIZE
36+
int "Send buffer size for UART"
37+
range 16 4096
38+
default 256
39+
help
40+
Amount of UART traffic waiting to be sent (TX), which can be held.
41+
If the buffers are full, all messages will be sent synchronously.
42+
43+
config MODEM_SLM_AT_CMD_RESP_MAX_SIZE
44+
int "Maximum size of AT command response from SLM"
45+
default 2100
2046
help
21-
The maximum number of bytes in receive buffer.
47+
The maximum size of the AT command response.
2248

2349
config MODEM_SLM_SHELL
2450
bool "SLM Shell"

0 commit comments

Comments
 (0)