ESP32 with GSM modem - PPP over Serial (PPPoS) client example

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP32 with GSM modem - PPP over Serial (PPPoS) client example

Postby Ritesh » Wed Aug 08, 2018 9:21 am

Hi Loboris,

I have one question like do we need to add interface input for GSM as well into TCP IP Adapter Interface Input List like WiFi STA, WiFi Ap and Ethernet Interface if we plan to add GSM Interface as well with ESP32?

/* TODO: add Ethernet interface */
typedef enum {
TCPIP_ADAPTER_IF_STA = 0, /**< ESP32 station interface */
TCPIP_ADAPTER_IF_AP, /**< ESP32 soft-AP interface */
TCPIP_ADAPTER_IF_ETH, /**< ESP32 ethernet interface */
TCPIP_ADAPTER_IF_MAX
} tcpip_adapter_if_t;
Regards,
Ritesh Prajapati

mr1000
Posts: 23
Joined: Fri Jan 12, 2018 9:05 am

Re: ESP32 with GSM modem - PPP over Serial (PPPoS) client example

Postby mr1000 » Wed Aug 29, 2018 7:57 am

Has someone faced issues when downloading 'large' files with the GSM? (Same file download using WIFI has no problem)

I'm downloading a 100Kb file, but when GSM module reads it, gets stuck at 16Kb aprox.
The first 16 chunks of 1024 bytes are read ok, but then it starts to 'Dropping bad fcs...''

I attach PPP DEBUG:
https://pastebin.com/ZYGKEZvE

I'm using same functions of loboris example
For reading via HTTPS I'm doing like the example

Code: Select all

do
        {
            len = BUFFSIZE;
            ret = mbedtls_ssl_read(&ssl, (unsigned char *)bufferRead, len);

            if(ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE)
            {
			...
            }

            if(ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
            {
			...
            }

            if( ret < 0 ) /* receive error */
            {
			...
            }
            else if( (ret > 0) && (!resp_body_start) )	/* reading header first and a piece of body */
            {
			...
            }
            else if( (ret > 0) && (resp_body_start) )	/* already read the header, reading body */
            {
			...
            }
            else if( ret == 0 )	/* packet over */
            {
			...
            }
        }
        while(1);
        
To make you an idea, I'm printing debug messages in each of the conditionals 'if' and when GSM gets stuck downloading, can't see more messages there.

Thanks in advance

EDIT: so in the library there's this comment (refering to Dropping bad FCS)
/* Note: If you get lots of these, check for UART frame errors or try different baud rate */
It's true that UART lines from ESP32 to module are relatively large (10 cm)
Gsm module works at 115200 by default, so I changed to 57600 still having bad FCS, then changed to 38400 and it worked
Not sure if the problem is really a hw issue or just the baudrate was too fast that internal libraries couldnt take that speed.

Ansics
Posts: 8
Joined: Mon May 22, 2017 11:27 am

Re: ESP32 with GSM modem - PPP over Serial (PPPoS) client example

Postby Ansics » Tue Oct 23, 2018 1:00 pm

markwj wrote:
Ansics wrote:What is the expected output of this PPPOS?
I have interfaced GSM module(from simcom) with ESP32 and ESP32 is in WIFI AP mode. I need internet access to devices which are connected to ESP.
A wifi hotspot? What you would need is:
  • A router for messages going between the two interfaces.
  • To do Source NAT (changing source IP address of outgoing Wifi traffic to IP of PPPoS link, and possibly changing source port if a conflict with another connection arises)
  • Connection tracking for the above (to address source port conflicts)
  • Connection tracking helpers for the more complex protocols (FTP, for example)
The code for this is not in the current ESP-IDF framework and is non-trivial.
My ESP32 is working as WIFI AP mode.
I connect my mobile with ESP32.
I also configured SIM5360 (3G module) with ESP32 and established ppp connection.

Now the problem is I need a bridge between wifi and ppp.
I need to make ESP32 as an internet hotspot which is using 3G module.

prateekn9
Posts: 4
Joined: Mon Feb 22, 2021 11:38 am

Re: ESP32 with GSM modem - PPP over Serial (PPPoS) client example

Postby prateekn9 » Tue May 11, 2021 4:40 am

loboris wrote:
Sun Oct 22, 2017 9:23 am
drbomb wrote:...
Is it possible to put the PPPoS connection in "Hold" while I send AT commands to the modem? I know I can escape the PPP interface with the <pause>+++<pause> sequence, but I'd like to be able to send the AT command and resume the PPPoS stack.
You have to execute ppposDisconnect(0,0) function, than you can send any AT command sequence.
After you are finished, execute ppposInit() to go back online.
Look at sms_task in main.c for an example.

The code of the pppos_client_task could be improved so that not the whole GSM modem initialization sequence is executed after offline mode and return to online faster (it is probably enough to only execute AT+CGDATA="PPP",1\r\n). I will test it.
Hey Loboris,
i tried to do the same as you mentioned above but after disconnecting when tried to send AT command i am getting timeout, can you help me out with this.

PIYUSHGIRI
Posts: 5
Joined: Sat Apr 10, 2021 11:10 am

Re: ESP32 with GSM modem - PPP over Serial (PPPoS) client example

Postby PIYUSHGIRI » Wed Jun 23, 2021 12:53 pm

hello everyone,
i am using Neoway-N58 GSM module interface with esp32 wrover E kit and pppos with ESP NAT router murge example code run when i compile and execute code than its get below output,
First i connect wifi with esp NAT router than i enter show command in consol than PPPos start but after pppos start by ATD*99# command than AT0 command execute i want to know how this happen,
and also please let me know how can we work on pppos and esp_NAT_router wifi mode simultaneously,

please check below attached consol output,

after uart_write cmd =AT+CSQ
I (28034) pppos_example: rssi: 26, ber: 99
before uart_write
after uart_write cmd =AT+CGDCONT=1,"IP","CMNET"
before uart_write
after uart_write cmd =ATD*99#
before uart_write
after uart_write cmd =ATO
E (34034) sim800: sim800_set_working_mode(320): enter ppp mode failed
E (34034) esp-modem: esp_modem_dte_change_mode(397): set new working mode:1 failed
E (34044) esp-modem: esp_modem_start_ppp(578): enter ppp mode failed
E (34044) esp_netif_lwip: Post-attach callback of driver(0x3ffd8734) failed with -1
I (172684) wifi:new:<6,2>, old:<6,0>, ap:<6,2>, sta:<6,0>, prof:1
I (172694) wifi:station: 20:e2:02:0b:c9:cf join, AID=1, bgn, 40D
I (172694) ESP32 NAT router: 1. station connected
I (172714) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2
I (175124) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2

2) after i restart GSM module and check output than MQTT is working but after sometime got below error,please let me know how to resolve this error also,
I (121894) pppos_example: sent publish successful, msg_id=0
I (122284) pppos_example: MQTT_EVENT_DATA
TOPIC=/topic/esp-pppos
DATA=esp32-pppos
E (140544) esp-netif_lwip-ppp: pppos_input_tcpip failed with -1
E (140544) esp-netif_lwip-ppp: pppos_input_tcpip failed with -1

***ERROR*** A stack overflow in task uart_event has been detected.

Backtrace:0x400885b7:0x3ffd8730 0x40088c61:0x3ffd8750 0x40088f09:0x3ffd8770 0x40089d45:0x3ffd87f0 0x40088ffc:0x3ffd8810 0x40088fb2:0x0000000c |<-CORRUPTED
0x400885b7: panic_abort at C:/Users/Frank/Desktop/esp-idf/components/esp_system/panic.c:330

thanks & regard,
PIYUSH

Who is online

Users browsing this forum: No registered users and 4 guests