-
Notifications
You must be signed in to change notification settings - Fork 136
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
esp-modem: handle SIM card is deactivated (IDFGH-11605) #448
Comments
We already have some examples that retry connecting periodically with some timeout/backoff-time, e.g. esp-protocols/examples/esp_netif/multiple_netifs/main/ppp_connect_esp_modem.c Lines 55 to 93 in 1bf6843
esp-protocols/components/esp_modem/examples/ap_to_pppos/main/ap_to_pppos.c Lines 154 to 158 in 1bf6843
In your case, however, it would be useful to check for the reason of the disconnection (I think BG96 provides some netwrok act command to check the reason), as it makes no sense to retry the connection every 5 seconds if the reason is an unpaid cellular bill. |
Thank you @david-cermak
The initial connection stage works well.
If after 30 minutes, I reset the ESP32, then the reconnection works. My tests indicate that it takes about 10 minutes for the SIM to turn back on. My guess was that there is more work to be done, to ask the modem to refresh its connection and get an IP. |
I think that you're missing the hangup command: esp-protocols/examples/esp_netif/multiple_netifs/main/ppp_connect_esp_modem.c Lines 79 to 80 in 1bf6843
|
@david-cermak thank you
Could there be anything else I am missing? |
This is weird, could you please share the full log? Does this command succeed? esp_modem_set_mode(dce, ESP_MODEM_MODE_DATA) == ESP_OK |
@david-cermak yes that does succeed. Here are the full logs. It is running the full esp-aws-iot suite, so there are a lot of logs, sorry.
here are a successful reconnection, due to normal network connectivity issues
here is where I disable the SIM in the dashboard for the SIM card
here is where I give up after 15 minutes and press reset
here is where the code is at now
|
Interesting that I don't see this message in your log anymore:
(That's why I asked if the And by pressing reset, you reset only the ESP32, not the modem? Would it help if you destroy the I'm sorry I cannot see what's wrong. I think I would have to try to simulate this issue and look into it.
when you disable or re-enable your SIM card? |
@david-cermak thank you.
The first log was captured from a very different process, which I had created before discovering the ap_to_pppos example, and following that reconnect procedure.
correct, I just press reset on the ESP32. The initialization process does then toggle the PWK pin, which I believe triggers a reset in the modem. It looks like this:
I have not yet tried this. If you would like me to test that approach I can give it a shot.
I ran this test, and the function always returns
Thanks so much for your attention on this, I am happy to run whatever test that might help, should you decide to test this yourself. |
I upped the timeout to 90 seconds, and the reconnection routine succeeded. |
Closing as I don't have any better opinion. |
Answers checklist.
General issue report
Often times users do not pay their cellular bill on time, and so we get
Modem Disconnect from PPP Server
. If ex. the bill is then paid, the modem does not automatically reconnect, and requires a reset.If there is a good way to handle this case, can some example code possibly be provided?
How can I setup a loop to retry the connection to the PPP server?
(I am using BG96)
The text was updated successfully, but these errors were encountered: