lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] lwip with 4G modem


From: Giuseppe Modugno
Subject: Re: [lwip-users] lwip with 4G modem
Date: Wed, 13 Oct 2021 09:54:22 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

Il 12/10/2021 19:17, Sylvain Rochet ha scritto:
Hi Giuseppe,

On Tue, Oct 12, 2021 at 09:26:00AM +0200, Giuseppe Modugno wrote:
I have an embedded project where lwip is used in a microcontroller
(Cortex-M3 by LPC). The network interface is a standard Ethernet. The MCU
features a MMI interface with an external Ethernet PHY.

It works well, I'm able to open a MQTTs connection with a broker, enable NTP
request, download some file from HTTP server.

Now I'd like to use this project as a base for a new project, where the
network interface will be replaced by a 4G modem that is controlled by
standard AT commands.

My question is: what should I change in my project to replace Ethernet with
4G modem? I think I have to use ppp over a serial line to open a 4G data
connection and it seems ppp is supported by lwip distribution.

Yes, you need to use PPPoS(erial).

You have to setup your modem to enter PPP data mode then read/write
HDLC/PPP bytestreams from/to the modem and lwIP.

If I understand well, there's a standard AT command to define a PPP-type PDP context for cellular modems (defined in ETS TS 127 007):

  AT+CGDCONT=<cid>,[<PDP_type>]....

where:

  <PDP_type> is a string that could be "PPP",...

So I think I must send the command:

  AT+CGDCONT=1,"PPP",...
  AT+CGATT=1
  AT+CGACT=1,1

to activate PDP context in PPP mode. However the specifications says, regarding AT+CGACT:

   After the command has completed, the MT remains in V.250
   command state.

So the question is: how to switch to V.250 online mode? The only command that should switch to V.250 online mode is +CGDATA, but I couldn't understand how to use, because it seems it replaces +CGATT and +CGACT. I think it should be:

  AT+CGDCONT=1,"PPP",...
  AT+CGDATA="PPP",1

There's another method to activate data connection, this is named "modem compatibility mode". You can use "old" ATD command to establish a data connection, receiveng CONNECT as the answer and entering V.250 online data state:

  ATD*99#;


Reading the specifications I noted there is another PDP_type, that is "IP". So I'm wondering if PPP is mandatary or can be avoided completely by activating a IP-based PDP type.

PPP is a little complex, so it would be nice if it can be avoided at all.



Another question (I don't know if it is OT), will I be able to make voice
calls at the same time the data connection is open and active?

This is not related to lwIP, check your modem documentation ;-)


The serial channel for ppp/data and AT commands is single, so how can
I multiplex them? Should I use CMUX?

CMUX is the proper way to do so.


Last question. If I have 4G modem and Ethernet PHY, is lwip able to manage
two network interface at the same time?

Yes! Beware of routing though, you will probably have to set the default
interface to the currently "working" interface and have to re-establish
all currently active TCP/UDP sessions on routing change.
Ok, thanks for suggesting.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]