Every time I moved my NB 1500 to a different location, it will lock up won't responding and need to be reset. But data connection appears to be still connected from cell carrier side. Any idea why?
Is it because device lost connection to original cell tower and I need to initiate another network connection attempt?
In the code, do you need something to monitor the GPRS status and try to reconnect if connection lost? I am wondering maybe there is a hole in the coverage and when ublox lost cellular connection, it won't automatically reconnect when back into the coverage range?
It appear more like the CPU locks up not the modem? Soracom, my connection provider, still report this device's connection is online? I can't tell for sure.
I have in the code to turn on LED when running the loop code. Since the LED is stucked at solid. I am guessing either the CPU locks up or mqttClient.poll() is causing it to lock up?
I was able to confirm the board freezing is due to network signal loss. I unplug the antenna to simulate a signal loss. The board freeze shortly in the same way as when I move it to a different location. It won't come back to life after I plug the antenna back.
Reattach the GPRS with the MKRNB lib within the loop.
Just a idea as a code fragment:
if (client.connected() == 0)
{
MODEM.send("AT+CREG?");
String response = "";
if (MODEM.waitForResponse(2000, &response) == 1) {
if (response.startsWith("+CREG: ")) {
if (response.endsWith(",1")) {
Serial.println("Modem is connected to mobile network, let's open a TCP socket");
gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD);
client.connect("username", "channel", "password");