BG95-M3 TCP PPP terminated after 40 minutes

In my project I have custom board connecting to MQTT broker. Board will be connected either with Ethernet or with GSM. GSM module is BG95-M3. In code there is lwIP internet stack and two network interfaces one for ETH-ARP and one for GSM-PPP. GSM is connected with PPP over serial. Device is connecting correctly using both interfaces and I am able to transmit and receive data on both interfaces. Unfortunately about 40 to 60 minutes after connecting with GSM I am facing disconnect problem. I am sending keepalive package every 60 s and after about 40 minutes device doesn’t receive response from broker for two keepalive packages and I am being disconnected from PPP by lwIP stack. When keepalive packages don’t get responses also messages send to device topics don’t arrive to board.

On the other hand Ethernet connection is stable for and I don’t see any problems there. Please help me to find root of problem and help me to fix it. I would like to have continue connection to broker as device needs to be connected 24/7 without service breaks.

Based your description , i think it caused by the wireless resource management strategy of the operator. You can email to support@quectel.com ,we can help you analyze the modem log to get the detail cause .

Stephen, thank you for your response. I have done some tests regarding my serial port driver and I managed to keep PPP connection for 1 day. I think that problem was with my code. I have increased performance of my lwIP stack and add additional space to buffers. It seems that currently PPP connection is stable.

Here I left some tips for other people having troubles with PPP connections.

  1. Find why you are getting disconnected -> in my case connection was termination by stack timeout.
  2. Check serial driver and make sure that all data are correctly send to TCP thread (no lost data).
  3. If you are allocating buffers for data send to lwIP thread, make sure that there is enough space in pool for allocation