We are using EG915 module under Linux in ECM mode.
When the system powers on and the Linux system boots we run a script that checks whether the APN needs to be set. The scripts does this via the serial interface and AT commands.
The script performs the following AT commands when APN needs to be changed (or setup for the first time). The script waits for the module to reply after each command is sent before sending the next command and checks for OK or any errors or unexpected replies.
check the currently set APN
AT+CGDCONT?
disconnect the network adapter
AT+QNETDEVCTL=0
deactivate current PDP
AT+CGACT=0,1
dettach PS
AT+CGATT=0
delete current PDP
AT+CGDCONT=1
create PDP with the new APN
AT+CGDCONT=1,“IPV4V6”,“”
set network adapter connect type to auto and PDP 1
AT+QNETDEVCTL=3,1
This procedure works, but is unreliable. Often it will fail with +CME ERROR: 50 at some command (CG+CGATT=0, AT+CGDCONT=1 or AT+CGDCONT=1,…). Then the module will not be set up correctly on boot and the network connection will not work. Repeating the same procedure later will sometimes work again. The problem can be reproduced by manually typing AT commands into the terminal, so it’s not an issue with how the script handles the AT interface.
I suspect that the problem is some kind of a race condition in regard to module registering on the mobile network, or that we are not using the correct sequence of commands for deleting and creating the PDP. The “AT commands manual” doesn’t go into such detail and neither does GSM 07.07.
Is there a document that describes the correct procedure for setting up the APN in our use case?
Module version:
Quectel
EG915U
Revision: EG915UEUABR03A01M08