vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.91k stars 713 forks source link

FIFO possible bug #563

Open MarianoFr opened 3 years ago

MarianoFr commented 3 years ago

[ ] Bug or issue with library functionality (ie, sending data over TCP/IP)

Modem: SIM7000G Main processor board: ESP32 TinyGSM version: latest (0.11.4) Code: No need for code. When subscribing to an mqtt broker (Azure), i suceed in this operation but when receiving messages greater than the FIFO available, the function modemReads only reads 63 bytes when getAvailable returns a minimum of 99 with Azures message format. The library seems to enter a loop and won't return any data till the socket closes. Any help is much appreciated Thanks

MarianoFr commented 3 years ago

After working for a while, sending individual AT commands, messages received from the broker are incomplete when using CA commands. For example, I achive a correct connection to the server, but as a response from the broker, the CONNACK message is: 0x20 0x02 0x0D 0x0A, when as per mqtt.org this should be 0x20 0x02 0x00 0x00 for success and 0x20 0x02 0x00 0x01 for failure. The bytes 0x0D and 0x0A are carriage return and new line. extensibly used by sim7000 to delimit commands. Despite this, I can publish messages to the broker. So I believe there's an issue with the receiving buffer in the sim7000G or maybe with the firmware because this behaviour is repeated with other messages, it happens with SUBACK with the payload being corrupted by 0x0D and 0x0A, while this messages header is correct, being 0x90 0x03. And there's no problem when connecting with CIP commands. Also this happens with and without SSL support. Any help is much appreciated