Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portenta CAT.M1/NB IoT GNSS Shield connecting failure #970

Open
brinata opened this issue Oct 3, 2024 · 11 comments · May be fixed by #975
Open

Portenta CAT.M1/NB IoT GNSS Shield connecting failure #970

brinata opened this issue Oct 3, 2024 · 11 comments · May be fixed by #975
Assignees

Comments

@brinata
Copy link

brinata commented Oct 3, 2024

Hello,

I'm using the Portenta CAT.M1/NB IoT GNSS Shield with the EDGE CONTROL board.

if the application fails the initial connection process because the signal strength is low or because the general latency of the GSM network, the GSM library in not able to reconnect: when I try to run the GSM.begin() again, the application program stop working after receiving the "^SYSSTART" string from the modem:

The board was not able to register to the network...
[000270[INFO][CELL]: AT TX ( 2): AT
[000270[INFO][CELL]: AT TX ( 1):
[000303[INFO][CELL]: AT RX ( 2):
[000303[INFO][CELL]: AT RX (11): ^SYSSTART
[000304[INFO][CELL]: AT RX ( 2):
[000304[INFO][CELL]: AT RX ( 6): +CIEV:
[000304[INFO][CELL]: AT RX (14): prov,0,"fallb
[000304[INFO][CELL]: AT RX ( 7): 3gpp"

The only way to re-start is reset the board.

I'm using the mbed 4.1.15

to simulate the problem I forced the following retry table in the GSM.h file:

const uint16_t _retry_timeout[3] = {1, 2, 4};

Please help me because I can't reset the whole application program to re-start the connectivity ....

GSMClient.txt
sketch_yaml.txt

@pennam pennam linked a pull request Oct 16, 2024 that will close this issue
@pennam
Copy link
Contributor

pennam commented Oct 16, 2024

@brinata I think I was able to reproduce your issue and I've proposed a fix in #975 . The PR needs to be used with some other changes in the Arduino_ConnectionHandler arduino-libraries/Arduino_ConnectionHandler#131

Do you mind give it a spin on your hardware?

Thanks

@brinata
Copy link
Author

brinata commented Oct 28, 2024

I've made some test, with these results:

moduel non connected yet

setting the timeout value at 1000 ms and calling the shutdown(), it seems that the library is able to re-try the connection procedure with success

module already connected

if you call the GSM.disconnect() function, then the library is not able to recover its initial state and the only way to re-initialize the Gsm Interface is reboot the cpu

@pennam
Copy link
Contributor

pennam commented Oct 28, 2024

module already connected

if you call the GSM.disconnect() function, then the library is not able to recover its initial state and the only way to re-initialize the Gsm Interface is reboot the cpu

@brinata can you share the sketch to reproduce this scenario?

@pennam
Copy link
Contributor

pennam commented Oct 28, 2024

@brinata also make sure to call GSM.end() after GSM.disconnect() and before the new GSMbegin() retry.

@brinata
Copy link
Author

brinata commented Oct 29, 2024

here the sketch GSMClient.txt

please note that:
if you run the GSM.begin() with reset = false and you don't call the _device->shutdown() it works
I've modified the end function as follow:
void arduino::GSMClass::end() {
if(_device) {
_device->shutdown();
_device->get_at_handler()->set_urc_handler("^SYSSTART", nullptr);
}
}
because the SYSSTART handler tries to close all the sockets after reboot, locking the modem: cancelling the ^SYSSTART handler the modem is not locket any more, but the connection is still missing ....

... please help

@pennam
Copy link
Contributor

pennam commented Oct 31, 2024

Hi @brinata
I was able to reproduce the issue and found a fix.
I've rebased #975 on the main branch included your suggestion to disable ^SYSSTART urc on shutdown and added the fix that allows reconnections.

I've also updated the connectionHandler PR arduino-libraries/Arduino_ConnectionHandler#131 including a test sketch that is doing the following:

  • connects to the network
  • make recurring http requests while connected
  • disconnect from the network after 60s
  • wait 60s before connecting again to the network and restart http requests

@brinata
Copy link
Author

brinata commented Nov 5, 2024

Hi Pennam,

Was you able to verify if the GSM library works when an "Asynchronous" disconnection happens ? for instance, when the account credit is expired or when the signal strenght is poor ?

Moreover, very often Network operators allow the connection with no account credit, even if the connection will not work....

how is it possibile to check these condition ?

As writtend in the CINTERION dos, About the ^SYSSTART, I suggest to use it to generate an event that signals the modem startup.

for the shutdown , reset, and re-start , the manual suggest the software fast shutdown command AT^SMSO="fast" to power off the module and the AT+CFUN=1,1 to reset it

About Hardware reset, the docs say:

Warning:
Use the EMERG_RST line only when, due to serious problems, the software is not responding
for more than 5 seconds. Pulling the EMERG_RST line causes the loss of all information
stored in the volatile memory. Therefore, this procedure is intended only for use in case of
emergency, e.g. if Cinterion® TX62/TX82 does not respond, if reset or shutdown via AT
command fails.

@pennam
Copy link
Contributor

pennam commented Nov 15, 2024

Hi @brinata,
I've updated #975 and arduino-libraries/Arduino_ConnectionHandler#131 to address your requests.

  • Emergency reset is disabled by default, and no more triggered each time begin() fuction is called. I've addad a bit of logic to the ConnectionHandler in order to trigger a modem hardware reset if network registration fails, but this is not mandatory and can be removed.

  • shutdown function does not call anymore AT+CFUN=0. it just reset the internal cellular state machine, so ^SYSSTART is not triggered anymore each time begin is called. I've also restored the ^SYSTART URC and to be safe I've reduced the AT timeout in the SYSSTART handler to avoid to get stuck closing the sockets and trigger the watchdog.

  • I've added GSM.off() to send AT^SMSO="fast" and GSM.reset() to send AT+CFUN=1,1. This two functions should be called always after GSM.end()

Was you able to verify if the GSM library works when an "Asynchronous" disconnection happens ? for instance, when the account credit is expired or when the signal strenght is poor ?

I've made some test about this disconnecting the antenna from the modem. As soon as the modem detects there is no network the +CGEV: NW DET urc is triggered and the network status is updated. You can check this condition from the application calling GSM.isConnected() like is done in the connectionHandler.

Moreover, very often Network operators allow the connection with no account credit, even if the connection will not work.... how is it possibile to check these condition ?

In this condition GSM.isConnected() is returning true, but the sockets will timeout. I've added the GSM.ping(...) function and added a check inside the connectionHandler before the transition to the CONNECTED state. If the modem is attached to the network, but there is no connectivity it will stay in the DISCONNECTED state.

@brinata
Copy link
Author

brinata commented Dec 9, 2024

Hi Pennam,

After several tests I discovered that sometimes some modules didn’t reply after a fast startup like after a hardware reset of the EDGE CONTROL board.
After some more tests I discovered those specific modules re-started replying if left without power supply for at least 60 sec.
After that I discovered that the FAST_SHUTDOWN line of the chip modem is not floating, because is always driver by a level shifter buffer: the net “FST_SHDN_LS” ( 3V3 domain) always drives the net “FST_SHDN” ( 1v8 domain) ; I tried to place a 10K resistor between the pin 2 - FST_SHDN_LS of the mkr header and the +3V3 and it seems it works better, up to now the catm1 module always starts, in every condition ( the "FST_SHDN" line seems to be driven by a buffer, non by an open collector circuit )

Is it possible that in some condition the module was kept in permanent shutdown in a "bad" internal state ?

I modified the start-up procedure as follow:

end();
// off();

int attempt = 0;
while( 1 ) {

    switch(attempt) {
        case 2:
            DEBUG_WARNING("Reset Modem");
            hardwareReset();

        case 1:
            DEBUG_INFO("Starting Modem");

            pinMode(MBED_CONF_GEMALTO_CINTERION_RST, OUTPUT);
            digitalWrite(MBED_CONF_GEMALTO_CINTERION_RST, LOW);

            pinMode(MBED_CONF_GEMALTO_CINTERION_ON, OUTPUT);
            digitalWrite(MBED_CONF_GEMALTO_CINTERION_ON, LOW);  

            pinMode(ON_MKR2, OUTPUT);
            digitalWrite(ON_MKR2, HIGH);

            delay(500);


            on();

            delay(5000);
            break;
        case 0:
            DEBUG_INFO("check Modem");
            break;
        default:
            return 0;
            break;
    }
    if(_device->is_ready() == NSAPI_ERROR_OK) {
        break;
    }
    attempt++;
}

void arduino::GSMClass::on() {
/* Module needs a rising edge to power on */
pinMode(MBED_CONF_GEMALTO_CINTERION_ON, OUTPUT);
digitalWrite(MBED_CONF_GEMALTO_CINTERION_ON, LOW);
delay(100);
digitalWrite(MBED_CONF_GEMALTO_CINTERION_ON, HIGH);
delay(100);
digitalWrite(MBED_CONF_GEMALTO_CINTERION_ON, LOW);
delay(30);
digitalWrite(MBED_CONF_GEMALTO_CINTERION_ON, HIGH);

}

I added a double power on edge because I found on some Cinterion document that was a workaround to have a sure startup.

The off() call can be useful only if you want to power off the module because this command the module stop communicating

Can you verify this behaviour on the project documentation ?

regards

@pennam
Copy link
Contributor

pennam commented Dec 10, 2024

Hi @brinata
Thanks for the feedback, I will verify and let you know!

@brinata
Copy link
Author

brinata commented Dec 17, 2024

Hi Pennam,

this morning, at the first starup, The Portenta CAT.M1/NB IoT GNSS Shield was blocked again ! to unlock it I had to disconnect it from the interposer and then i started working again.....

... Yesterday I didn't disconnect it from edge control, I just switched off the power supply

The fast shutdown pin of the CAT.M1/NB IoT GNSS Shield is still pulled up to 3v3, nevertheless the voltage of the pin was around 1,2 v ...

please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants