Skip to content

Commit 3a3dc3b

Browse files
committed
app: Don't start PPP without a request
PPP connection has been opened automatically when AT+CFUN=1 is done and PDN has been activated even without PPP request using AT#XPPP=1. This is now changed so you need to issue AT#XPPP=1 in order to start PPP. This can be done before or after AT+CFUN=1. Enabled CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC forgotten in PR #6. Jira: SLM-85 Signed-off-by: Tommi Rantanen <tommi.rantanen@nordicsemi.no>
1 parent a3be791 commit 3a3dc3b

6 files changed

Lines changed: 21 additions & 27 deletions

File tree

app/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ config SM_FULL_FOTA
143143

144144
config SM_PPP
145145
bool "PPP support"
146-
help
147-
When enabled, Serial Modem automatically brings up/down the PPP link
148-
when the LTE link (default PDN) is connected/disconnected,
149-
regardless of what is done with AT#XPPP.
150146

151147
if SM_PPP
152148

app/overlay-ppp-without-cmux.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
# Enable modem UART backend
77
CONFIG_MODEM_BACKEND_UART=y
88
CONFIG_MODEM_BACKEND_UART_ASYNC=y
9+
CONFIG_MODEM_BACKEND_UART_ASYNC_HWFC=y

app/scripts/sm_start_ppp.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ stty -F $AT_CMUX clocal
5454

5555
echo "Connect and wait for PPP link..."
5656
test -c $AT_CMUX
57+
chat $CHATOPT -t$TIMEOUT "" "AT#XPPP=1" "OK" >$AT_CMUX <$AT_CMUX
5758
chat $CHATOPT -t$TIMEOUT "" "AT+CFUN=1" "OK" "\c" "#XPPP: 1,0" >$AT_CMUX <$AT_CMUX
5859

5960
pppd $PPP_CMUX noauth novj nodeflate nobsdcomp debug noipdefault passive +ipv6 noremoteip \

app/src/sm_ppp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static void subscribe_cgev_notifications(void)
476476
}
477477
}
478478

479-
AT_MONITOR(sm_ppp_on_cgev, "CGEV", at_notif_on_cgev);
479+
AT_MONITOR(sm_ppp_on_cgev, "CGEV", at_notif_on_cgev, PAUSED);
480480

481481
static void at_notif_on_cgev(const char *notify)
482482
{
@@ -694,8 +694,10 @@ static int handle_at_ppp(enum at_parser_cmd_type cmd_type, struct at_parser *par
694694
/* Store PPP PDN if given */
695695
at_parser_num_get(parser, 2, &ppp_pdn_cid);
696696
delegate_ppp_event(PPP_START, PPP_REASON_DEFAULT);
697+
at_monitor_resume(&sm_ppp_on_cgev);
697698
} else {
698699
delegate_ppp_event(PPP_STOP, PPP_REASON_DEFAULT);
700+
at_monitor_pause(&sm_ppp_on_cgev);
699701
}
700702
return -SILENT_AT_COMMAND_RET;
701703
}

doc/app/PPP_AT_commands.rst

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ The set command allows you to start and stop PPP, and optionally define the PDN
3131

3232
.. note::
3333

34-
PPP is automatically started and stopped by |SM| when the PDN connection requested for PPP
35-
is established and lost, respectively.
36-
This happens even if PPP has previously been stopped or started with this command.
34+
When a PPP start has been issued, the PPP connection is automatically activated and deactivated when the PDN connection requested for PPP is established and lost, respectively.
35+
This will continue until a PPP stop is issued.
3736

3837
Syntax
3938
~~~~~~
@@ -77,22 +76,12 @@ PPP with default PDN connection:
7776

7877
::
7978

80-
AT+CFUN=1
81-
82-
OK
83-
84-
// PPP is automatically started when the default PDN is activated.
85-
#XPPP: 1,0,0
86-
87-
// Stop PPP.
88-
AT#XPPP=0
79+
// Start PPP.
80+
AT#XPPP=1
8981

9082
OK
9183

92-
#XPPP: 0,0
93-
94-
// Start PPP.
95-
AT#XPPP=1
84+
AT+CFUN=1
9685

9786
OK
9887

@@ -113,7 +102,7 @@ PPP with default PDN connection:
113102

114103
OK
115104

116-
#XPPP: 0,0
105+
#XPPP: 0,0,0
117106

118107
PPP with non-default PDN connection:
119108

@@ -125,8 +114,7 @@ PPP with non-default PDN connection:
125114

126115
OK
127116

128-
// Start PPP with the created PDN connection. This must be before AT+CFUN=1 command or
129-
// otherwise PPP will be started for the default PDN connection.
117+
// Start PPP with the created PDN connection.
130118
AT#XPPP=1,1
131119

132120
OK
@@ -172,8 +160,8 @@ If you are using CMUX, see :ref:`sm_as_linux_modem` for more information on sett
172160

173161
For the process described here, |SM|'s UARTs must be connected to the Linux host.
174162

175-
1. Get PPP running on |SM|.
176-
To do this, start |SM| and issue an ``AT+CFUN=1`` command.
163+
1. Start PPP with the ``AT#XPPP=1`` command.
164+
#. Set modem to online mode with the ``AT+CFUN=1`` command.
177165
#. Wait for ``#XPPP: 1,0,0``, which is sent when the network registration succeeds and PPP has started successfully with the default PDN connection.
178166
#. Run the following command on the Linux host:
179167

@@ -184,7 +172,7 @@ For the process described here, |SM|'s UARTs must be connected to the Linux host
184172
Replace ``<PPP_UART_dev>`` by the device file assigned to the PPP UART and ``<baud_rate>`` by the baud rate of the UART that PPP is using (which is set in the :file:`overlay-ppp-without-cmux.overlay` file).
185173
Typically, when ``uart1`` is assigned to be the PPP UART (in the devicetree overlay), the device file assigned to it is :file:`/dev/ttyACM2` for an nRF9160 DK, and :file:`/dev/ttyACM1` for the other nRF91 Series DKs.
186174

187-
#. After the PPP link negotiation has completed successfully, a new network interface will be available, typically ``ppp0``.
175+
#. After the PPP link negotiation has completed successfully, |SM| will send ``#XPPP: 1,1,0`` notification over UART, and a new network interface will be available, typically ``ppp0``.
188176
This network interface will allow sending and receiving IP traffic through the modem of the nRF91 Series SiP running |SM|.
189177

190178
.. note::

doc/migration_notes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ The following changes are mandatory to make your application work in the same wa
5757
* Removed the ``AT#XPOLL`` command.
5858
Use ``AT#XAPOLL`` instead.
5959

60+
* PPP connection must be requested using the ``AT#XPPP=1`` command to get it started when the modem is put into online mode using the ``AT+CFUN=1`` command.
61+
The ``AT#XPPP=1`` command can be run before or after the ``AT+CFUN=1`` command.
62+
So PPP connection is not started automatically anymore when the ``AT+CFUN=1`` command is run.
63+
After the ``AT#XPPP=1`` command is run, the PPP connection is started when the ``AT+CFUN=1`` command is run and stopped when network is lost (for example, with ``AT+CFUN=4`` or ``AT+CFUN=0``).
64+
When the ``AT#XPPP=0`` command is run, the PPP connection is stopped permanently.
65+
6066
DTR and RI GPIOs replace Power and Indicate pins
6167
------------------------------------------------
6268

0 commit comments

Comments
 (0)