Whenever I try to implement TCP/IP or MQTT the iTracker's BG96 hangs randomly either while sending data, opening sockets or connecting to a MQTT server. I've managed to send a few packets through both tcp and mqtt methods but the modem keeps hanging without a consistent behaviour. The worrying thing is that when the random hang occurs the BG96 stops responding to any AT Command and the Netlight turns off permanently. I've throughly checked the official documentation for AT commands for the BG96 and I'm currently using Keil and a modified version of the firmware provided by RakWireless repository on github. The issue happens with both 3G and 4G SIM cards.
As far as aI know the Netlight shouldn't stop blinking even if my AT commands were wrong, which I doubt because sometimes I manage to send more than 20 consecutive messages with 8-10 seconds between each one through TCP while sometimes I can't even go past the socket connection.
Is this a known bug with the modem's firmware or what am I doing wrong?