Hi Mike,
There are many reasons may cause cellular socket operation error. Intermittent connectivity is one reason and in extreme case cellular module may not response to AT command. I use this thread to discuss how to handle common error.
-
Cellular module not responding
This can be checked with simple “AT” command to see if “OK” is returned. If cellular modem can’t respond to AT command, reset cellular module is required. Before cellular module reset, Celllular_ClearUp() is required. After reset, setupCellular() provides example API calls to setup cellular modem. -
Cellular network not registered
This cellular demo uses automatic mode (AT+COPS=0) to select network operator. If the cellular module loss network connection, it will search the network and try to re-connect. Cellular_GetServiceStatus can be used to query registration status. Use Cellular_RegisterUrcNetworkRegistrationEventCallback for callback function if required by application. There are many factors related to network searching speed, for example RAT and band selection. You can refer the SARA-R4 application note for network registration. RF off/on you mentioned in this thread is a way to reconnect network. It is suggested to do this with exponential back-off.
If you are using FreeRTOS OTA over MQTT demo, OTA_Suspend and OTA_Resume are handled in prvMQTTAgentTask. Cellular module status can be checked at this line.
The following graph is a brief flow chart about how to handle cellular error in OTA.