Skip to content

isGprsConnected returns true when pdp network inactive when coming from PSM #829

@okvittem

Description

@okvittem

Hi,
isGprsConnected returns true even if APP network(CNACT) is not active.
It looks like that getLocalIPImpl uses +CGPADDR=1 to check if an IP is present
and returns true because there is an ip address there - i.e. PDP is active.

but you need to use CNACT to activate the APP network to run ping or TCP
so it returns: +CAOPEN: 0,1

This is a Sim7080G that is in PSM-mode and is awaken from sleep.
Then CGATT is 1 and CNACT: 0,0.
And "CNACT=0,1" is needed to get "+APP PDP: 0,ACTIVE"

gprsConnect do issue the cnact=0,1, but that is overkill when the modem is hot standby.
It uses 20 seconds for reset cgatt=0 and set cgatt=1.
"AT+cnact=0,1" does this immediately.

my code :
while (!gprsConnected) {
if ( try_cnact && modem.isGprsConnected()) {
modem.sendAT(GF("+CNACT=0,1"));
int res = modem.waitResponse(1000L, GF(AT_NL "+APP PDP: 0,ACTIVE"),
GF(AT_NL "+APP PDP: 0,DEACTIVE"), "ERROR");
modem.waitResponse(); // empty buffer
gprsConnected = res == 1;
try_cnact = false;
} else {
if (!modem.testAT()) {
power_modem();
}
wdt_disable(); // can take more than 16 sec
gprsConnected = modem.gprsConnect(apn, gprsUser, gprsPass);
wdt_reEnable();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions