Skip to content

How should modem disconnects/reconnects be handled in unstable connections? (IDFGH-11995) #498

Description

@mbastida123

Answers checklist.

  • I have read the documentation for esp-protocols components and the issue is not addressed there.
  • I have updated my esp-protocols branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

We currently have ~1000 devices deployed across Spain with a SIM7080G modem.

In general lines they work well, even the OTA.

However, in general we cannot guarantee a 100% success when it comes to updating via OTA or simply connecting to the internet.

The devices connect once every 24h, and sometimes that connection fails and so it becomes a connection every 48 or even 72h.

Up until now we were doing the following on IP_EVENT_PPP_LOST_IP:

} else if (event_id == IP_EVENT_PPP_LOST_IP) {
        ESP_LOGW(TAG, "Modem Disconnect from PPP Server");
        ESP_ERROR_CHECK(esp_event_post(GENERAL_EVENTS, GENERAL_EVENTS_INTERNET_CONNECTION_RETRY, NULL, NULL, portMAX_DELAY));
        if (connection_retries < MAX_CONNECTION_RETRIES)
        {         
            ESP_LOGD(TAG, "Retrying internet connection");
            ESP_ERROR_CHECK(esp_event_post(GENERAL_EVENTS, GENERAL_EVENTS_KICK_WDT_SERVICE_TIMEOUT, NULL, NULL, portMAX_DELAY));
            uint8_t task_create_retries=0;
            while(xTaskCreate(modem_restart, "modem restart", 4096, NULL, 10, NULL) != pdPASS && task_create_retries < 4){
                ESP_LOGD(TAG, "Could not create task, retrying");
                task_create_retries++;
            }                   
            connection_retries++;
        } 
        else{
            ESP_LOGD(TAG, "Exceeded internet connection retries. Abandoning");
            connection_retries=0;
            ESP_ERROR_CHECK(esp_event_post(GENERAL_EVENTS, GENERAL_EVENTS_INTERNET_CONNECTION_UNSUCCEEDED, NULL, NULL, portMAX_DELAY));
        }

So basically every time the connection got lost we would call modem_restart() which would basically initialize the modem again via esp_modem_get_signal_quality() and esp_modem_set_mode(dce, ESP_MODEM_MODE_DATA);

This doesn't work. And so what ends up working is straight reseting the ESP via esp_restart() and reseting the module by powering it down and powering it up again.
With this procedure the modem has a higher success of obtaining an IP. But the problem is that sometimes it takes 10-12min for that connection to be achieved. This is unacceptable mainly from a power usage standpoint.

So the question is, what should be the correct procedure for forcing the SIMCOM modem to try to reconnect?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions