I have been working on an MQTT protocol using the SIM5320. I am familiar with the AT command documentation, and have a working implementation with an Arduino.
- I open a network socket with
AT+NETOPEN - Then I open a TCP connection with
AT+CIPOPEN=0,"TCP","ip address",port. - I then transmit data for the MQTT protocol using
AT+CIPSEND, which executes successfully.
If I send data to the SIM module through MQTT, it is also received and the message is detected.
With MQTT, there is a Keep-Alive interval which specifies how long the server will keep a connection open between communication, basically how long the client can idle before being forcibly disconnected from the server. However, I have set this value to the maximum of 18 hours, which is far longer than the ~15 minute disconnections.
My issue arises after ~15 minutes, when I try sending a command to the server, and no response is given. The SIM has not issued a "+IPCLOSE: 0,4", which usually occurs when the server forcibly disconnects the client, or any other sort of indicator.
Additionally, I am still able to send data and it appears that the CIP connection is still open, as indicated by AT+CIPOPEN?. When I try and close the connection with AT+CIPCLOSE=0, I receive +CIPCLOSE: 0,4 and "ERROR". There is no mention of what +CIPCLOSE: 0,4 means in the documentation, however it does not seem to close the connection, as it cannot be opened or used.
I would really love to know what is happening in this 15 minutes, between establishing a connection and sending data, to attempting to send data again. There is no alert or any indication of anything going wrong, so I am seriously confused.
I initially asked this question on Electrical Engineering stack exchange, but was advised to ask it here as well.
I've attached the code I wrote here for anyone who would like to take a look, and there aren't any libraries you need to run it.