Hello,
I’m running OTA on top of the cellularlib. I’ve been making an endurance test and ran into several probably unrelated cellularlib problems. For each of these I will create a new topic.
Details
-Using the SARA-R410M with software 02B-01
-Running on a STM32L4S5
-Using the Cellular comm interface of the STM32L4S5 Discovery
For this particular problem the program fails to make a TLS connection due to a socket error. I observed this once in a 24 hour run of my code. The relevant error section in the log is:
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1273] Attempting to open TLS socket to broker...
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1284] Creating a TLS connection to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com:8883.
[ERROR] [TlsTransport] [using_mbedtls.c:550] Failed to perform TLS handshake: mbedTLSError= SSL - The connection indicated an EOF : <No-Low-Level-Code>.
[WARN] [OTADemo] [OtaOverMqttDemoExample.c:1302] Connection to the broker failed. Retrying connection in 0 ms.
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1284] Creating a TLS connection to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com:8883.
[ERROR] [TlsTransport] [using_mbedtls.c:550] Failed to perform TLS handshake: mbedTLSError= SSL - The connection indicated an EOF : <No-Low-Level-Code>.
[WARN] [OTADemo] [OtaOverMqttDemoExample.c:1302] Connection to the broker failed. Retrying connection in 346 ms.
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1284] Creating a TLS connection to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com:8883.
[ERROR] [TlsTransport] [using_mbedtls.c:550] Failed to perform TLS handshake: mbedTLSError= SSL - The connection indicated an EOF : <No-Low-Level-Code>.
[WARN] [OTADemo] [OtaOverMqttDemoExample.c:1302] Connection to the broker failed. Retrying connection in 130 ms.
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1284] Creating a TLS connection to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com:8883.
[ERROR] [TlsTransport] [using_mbedtls.c:550] Failed to perform TLS handshake: mbedTLSError= SSL - The connection indicated an EOF : <No-Low-Level-Code>.
[WARN] [OTADemo] [OtaOverMqttDemoExample.c:1302] Connection to the broker failed. Retrying connection in 2980 ms.
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1284] Creating a TLS connection to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com:8883.
[ERROR] [TlsTransport] [using_mbedtls.c:550] Failed to perform TLS handshake: mbedTLSError= SSL - The connection indicated an EOF : <No-Low-Level-Code>.
[WARN] [OTADemo] [OtaOverMqttDemoExample.c:1302] Connection to the broker failed. Retrying connection in 1090 ms.
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1284] Creating a TLS connection to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com:8883.
[ERROR] [TlsTransport] [using_mbedtls.c:550] Failed to perform TLS handshake: mbedTLSError= SSL - The connection indicated an EOF : <No-Low-Level-Code>.
[WARN] [OTADemo] [OtaOverMqttDemoExample.c:1302] Connection to the broker failed. Retrying connection in 1654 ms.
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1284] Creating a TLS connection to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com:8883.
[ERROR] [TlsTransport] [using_mbedtls.c:550] Failed to perform TLS handshake: mbedTLSError= SSL - The connection indicated an EOF : <No-Low-Level-Code>.
[WARN] [OTADemo] [OtaOverMqttDemoExample.c:1302] Connection to the broker failed. Retrying connection in 2116 ms.
[INFO] [OTADemo] [OtaOverMqttDemoExample.c:1284] Creating a TLS connection to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com:8883.
[WARN] [CellularLib] [cellular_pktio.c:367] Modem return ERROR: line AT+USOCR=6,0, cmd : +CME ERROR: Operation not allowed, respPrefix +USOCR, status: 0
[WARN] [CellularLib] [cellular_pkthandler.c:247] Modem returns error in sending AT command AT+USOCR=6,0, pktStatus 2.
[ERROR] [CellularLib] [cellular_r4_api.c:499] _Cellular_GetSocketNumber: get socekt number failed PktRet: 2
[ERROR] [CellularLib] [cellular_common.c:487] _Cellular_TranslatePktStatus: Status 2
[ERROR] [Sockets] [sockets_wrapper.c:700] Failed to establish new connection. Socket status 10.
[ERROR] [CellularLib] [cellular_r4_api.c:804] Cellular_SocketClose : invalid session ID for socket index 7
[ERROR] [TlsTransport] [using_mbedtls.c:670] Failed to connect to a32g9qwxlmbo20-ats.iot.eu-central-1.amazonaws.com with error -1.
[WARN] [OTADemo] [OtaOverMqttDemoExample.c:1302] Connection to the broker failed. Retrying connection in 2592 ms.
It then tries to reconnect a whole bunch of times before it eventally hangs in configASSERT( xNetworkStatus == pdPASS ); inside of prvConnectToMQTTBroker();
How to handle such a situation?
Here’s a complete log for reference:
AT+USOCR error.zip (6.5 KB)
-edit- I’m now re-running the code to reproduce while also logging the serial lines of the modem. I will add that later.