I have an issue similar to this:
however when the loop freezes on cloud.update, even when I reintroduce the wifi the IOT system does not make any effort to reconnect. Is there anything I can do to prevent the system from fully freezing like this?
I have an issue similar to this:
however when the loop freezes on cloud.update, even when I reintroduce the wifi the IOT system does not make any effort to reconnect. Is there anything I can do to prevent the system from fully freezing like this?
@peter-mimic which board are you using?
I am using the arduino MKR 1010 Wi-Fi board.
@peter-mimic would you share serial monitor logs?
[Thu Feb 13 11:04:26.838 2025] ArduinoIoTCloudTCP::updateCertificate request skipped.
[Thu Feb 13 11:04:26.838 2025] Begin start...
[Thu Feb 13 11:04:27.862 2025] Begin finished!
[Thu Feb 13 11:04:27.878 2025] ***** Arduino IoT Cloud - 2.3.1 *****
[Thu Feb 13 11:04:27.878 2025] Device ID: 5c079f72-5743-472c-b8ed-135d85cfe74b
[Thu Feb 13 11:04:27.878 2025] MQTT Broker: iot.arduino.cc:8885
[Thu Feb 13 11:04:31.436 2025] Sd card not detected
[Thu Feb 13 11:04:32.920 2025] Calling update....
[Thu Feb 13 11:04:32.936 2025] WiFi.status(): 0
[Thu Feb 13 11:04:32.936 2025] Current WiFi Firmware: 2.0.0
[Thu Feb 13 11:04:32.936 2025] Updated!
[Thu Feb 13 11:04:34.168 2025] Calling update....
[Thu Feb 13 11:04:36.117 2025] Connected to "SM-J320A 2944"
[Thu Feb 13 11:04:36.118 2025] Updated!
[Thu Feb 13 11:04:37.348 2025] Calling update....
[Thu Feb 13 11:04:38.020 2025] TimeServiceClass::sync done. Drift: -415 RTC value: 1739462677
[Thu Feb 13 11:04:38.036 2025] Updated!
[Thu Feb 13 11:04:39.273 2025] Calling update....
[Thu Feb 13 11:04:44.209 2025] Updated!
[Thu Feb 13 11:04:45.445 2025] Calling update....
[Thu Feb 13 11:04:45.454 2025] Updated!
[Thu Feb 13 11:04:46.697 2025] Calling update....
[Thu Feb 13 11:04:47.224 2025] Updated!
[Thu Feb 13 11:04:48.461 2025] Calling update....
[Thu Feb 13 11:04:48.669 2025] Connected to Arduino IoT Cloud
[Thu Feb 13 11:04:48.669 2025] Thing ID: e8cfa491-5071-45a2-b3ff-268abfea8f74
[Thu Feb 13 11:04:48.685 2025] Updated!
[Thu Feb 13 11:04:49.918 2025] Calling update....
[Thu Feb 13 11:04:49.918 2025] Updated!
[Thu Feb 13 11:04:51.154 2025] Calling update....
[Thu Feb 13 11:04:51.173 2025] Updated!
[Thu Feb 13 11:04:52.411 2025] Calling update....
[Thu Feb 13 11:04:52.447 2025] TimeServiceClass::setTimeZoneData offset: -18000 dst_unitl 1741503600
[Thu Feb 13 11:04:52.456 2025] Updated!
[Thu Feb 13 11:04:53.712 2025] Calling update....
[Thu Feb 13 11:04:53.753 2025] Updated!
[Thu Feb 13 11:04:55.014 2025] Calling update....
[Thu Feb 13 11:04:55.046 2025] Updated!
[Thu Feb 13 11:04:56.310 2025] Calling update....
[Thu Feb 13 11:04:56.359 2025] Updated!
[Thu Feb 13 11:04:57.614 2025] Calling update....
[Thu Feb 13 11:04:57.663 2025] Updated!
[Thu Feb 13 11:04:58.919 2025] Calling update....
[Thu Feb 13 11:04:58.967 2025] Updated!
[Thu Feb 13 11:05:00.216 2025] Calling update....
[Thu Feb 13 11:05:00.262 2025] Updated!
[Thu Feb 13 11:05:01.503 2025] Calling update....
[Thu Feb 13 11:05:01.565 2025] Updated!
[Thu Feb 13 11:05:02.816 2025] Calling update....
[Thu Feb 13 11:05:02.864 2025] Updated!
[Thu Feb 13 11:05:04.112 2025] Calling update....
[Thu Feb 13 11:05:04.160 2025] Updated!
[Thu Feb 13 11:05:05.415 2025] Calling update....
[Thu Feb 13 11:05:05.464 2025] Updated!
[Thu Feb 13 11:05:06.712 2025] Calling update....
[Thu Feb 13 11:05:06.750 2025] Updated!
[Thu Feb 13 11:05:08.006 2025] Calling update....
[Thu Feb 13 11:05:08.054 2025] Updated!
[Thu Feb 13 11:05:09.307 2025] Calling update....
[Thu Feb 13 11:05:09.366 2025] Updated!
[Thu Feb 13 11:05:10.618 2025] Calling update....
[Thu Feb 13 11:05:10.667 2025] Updated!
[Thu Feb 13 11:05:11.923 2025] Calling update....
[Thu Feb 13 11:05:11.972 2025] Updated!
[Thu Feb 13 11:05:13.227 2025] Calling update....
[Thu Feb 13 11:05:13.273 2025] Updated!
[Thu Feb 13 11:05:14.523 2025] Calling update....
[Thu Feb 13 11:05:14.573 2025] Updated!
[Thu Feb 13 11:05:15.820 2025] Calling update....
[Thu Feb 13 11:05:15.868 2025] Updated!
[Thu Feb 13 11:05:17.132 2025] Calling update....
[Thu Feb 13 11:05:17.173 2025] Updated!
[Thu Feb 13 11:05:18.429 2025] Calling update....
[Thu Feb 13 11:05:18.478 2025] Updated!
[Thu Feb 13 11:05:19.724 2025] Calling update....
[Thu Feb 13 11:05:19.779 2025] Updated!
[Thu Feb 13 11:05:21.033 2025] Calling update....
[Thu Feb 13 11:05:21.081 2025] Updated!
[Thu Feb 13 11:05:22.327 2025] Calling update....
[Thu Feb 13 11:05:22.378 2025] Updated!
[Thu Feb 13 11:05:23.630 2025] Calling update....
[Thu Feb 13 11:05:23.677 2025] Updated!
[Thu Feb 13 11:05:24.927 2025] Calling update....
[Thu Feb 13 11:05:24.975 2025] Updated!
[Thu Feb 13 11:05:26.241 2025] Calling update....
[Thu Feb 13 11:05:26.279 2025] Updated!
[Thu Feb 13 11:05:27.529 2025] Calling update....
[Thu Feb 13 11:05:27.576 2025] Updated!
[Thu Feb 13 11:05:28.841 2025] Calling update....
[Thu Feb 13 11:05:28.885 2025] Updated!
[Thu Feb 13 11:05:30.147 2025] Calling update....
[Thu Feb 13 11:05:30.193 2025] Updated!
[Thu Feb 13 11:05:31.443 2025] Calling update....
[Thu Feb 13 11:05:31.491 2025] Updated!
[Thu Feb 13 11:05:32.732 2025] Calling update....
[Thu Feb 13 11:05:32.787 2025] Updated!
[Thu Feb 13 11:05:34.050 2025] Calling update....
[Thu Feb 13 11:05:34.091 2025] Updated!
[Thu Feb 13 11:05:35.347 2025] Calling update....
[Thu Feb 13 11:05:35.396 2025] Updated!
[Thu Feb 13 11:05:36.653 2025] Calling update....
[Thu Feb 13 11:05:36.700 2025] Updated!
[Thu Feb 13 11:05:37.953 2025] Calling update....
[Thu Feb 13 11:05:38.001 2025] Updated!
[Thu Feb 13 11:05:39.257 2025] Calling update....
[Thu Feb 13 11:05:39.305 2025] Updated!
[Thu Feb 13 11:05:40.554 2025] Calling update....
[Thu Feb 13 11:05:40.602 2025] Updated!
[Thu Feb 13 11:05:41.855 2025] Calling update....
[Thu Feb 13 11:05:41.896 2025] Updated!
[Thu Feb 13 11:05:43.145 2025] Calling update....
[Thu Feb 13 11:05:43.203 2025] Updated!
[Thu Feb 13 11:05:44.445 2025] Calling update....
[Thu Feb 13 11:05:44.492 2025] Updated!
[Thu Feb 13 11:05:45.751 2025] Calling update....
[Thu Feb 13 11:05:45.798 2025] Updated!
[Thu Feb 13 11:05:47.058 2025] Calling update....
[Thu Feb 13 11:05:47.105 2025] Updated!
[Thu Feb 13 11:05:48.363 2025] Calling update....
[Thu Feb 13 11:05:48.411 2025] Updated!
[Thu Feb 13 11:05:49.667 2025] Calling update....
[Thu Feb 13 11:05:49.706 2025] Updated!
[Thu Feb 13 11:05:50.965 2025] Calling update....
[Thu Feb 13 11:05:51.016 2025] Updated!
[Thu Feb 13 11:05:52.260 2025] Calling update....
[Thu Feb 13 11:05:52.308 2025] Updated!
[Thu Feb 13 11:05:53.568 2025] Calling update....
[Thu Feb 13 11:05:53.616 2025] Updated!
[Thu Feb 13 11:05:54.870 2025] Calling update....
[Thu Feb 13 11:05:54.920 2025] Updated!
[Thu Feb 13 11:05:56.172 2025] Calling update....
[Thu Feb 13 11:05:56.218 2025] Updated!
[Thu Feb 13 11:05:57.464 2025] Calling update....
[Thu Feb 13 11:05:57.512 2025] Updated!
[Thu Feb 13 11:05:58.761 2025] Calling update....
[Thu Feb 13 11:05:58.809 2025] Updated!
[Thu Feb 13 11:06:00.074 2025] Calling update....
[Thu Feb 13 11:06:00.122 2025] Updated!
[Thu Feb 13 11:06:01.373 2025] Calling update....
[Thu Feb 13 11:06:01.426 2025] Updated!
[Thu Feb 13 11:06:02.668 2025] Calling update....
[Thu Feb 13 11:06:02.729 2025] Updated!
[Thu Feb 13 11:06:03.974 2025] Calling update....
[Thu Feb 13 11:06:04.021 2025] Updated!
[Thu Feb 13 11:06:05.268 2025] Calling update....
[Thu Feb 13 11:06:05.316 2025] Updated!
[Thu Feb 13 11:06:06.570 2025] Calling update....
[Thu Feb 13 11:06:06.617 2025] Updated!
[Thu Feb 13 11:06:07.878 2025] Calling update....
[Thu Feb 13 11:06:07.928 2025] Updated!
[Thu Feb 13 11:06:09.172 2025] Calling update....
[Thu Feb 13 11:06:09.218 2025] Updated!
[Thu Feb 13 11:06:10.466 2025] Calling update....
[Thu Feb 13 11:06:10.514 2025] Updated!
[Thu Feb 13 11:06:11.777 2025] Calling update....
[Thu Feb 13 11:06:11.830 2025] Updated!
[Thu Feb 13 11:06:13.079 2025] Calling update....
[Thu Feb 13 11:06:13.123 2025] Updated!
[Thu Feb 13 11:06:14.369 2025] Calling update....
[Thu Feb 13 11:06:14.417 2025] Updated!
[Thu Feb 13 11:06:15.669 2025] Calling update....
[Thu Feb 13 11:06:15.717 2025] Updated!
[Thu Feb 13 11:06:16.982 2025] Calling update....
[Thu Feb 13 11:06:17.030 2025] Updated!
[Thu Feb 13 11:06:18.278 2025] Calling update....
This is a case in where I start while connected to a mobile hotspot and then the internet connection goes out.
When the internet connection goes out loop() continues for a specific amount of time and then stops.
It stops completely or loop speed slows down to 50s ? Did you try to reduce the default WiFi timeout using WiFi.setTimeout() ?
It stops completely in that final ping to arduinoCloud.
Does the board stay connected to WiFi ? It is a bit weird that it stops completely and I'm trying to reproduce it without success...
The board stops when disconnected to wifi after running for a while and when wifi returns, it does not return to running. This is different from taking down the entire connection, it's simply removing the internet connectivity and not its connection to something like a mobile hotspot or a router hosting it.
From the log you sent board is always connected to WiFi. What goes off is internet connection. This is what I'm testing.
Yes, what is removed is the internet connection itself.
I can provide the code I ran for it if you would like (it's very simplistic).
Yes it would help to understand
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/770b0b07-562a-4db0-a77f-22a80185169b
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int counter;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
#include <Arduino_MKRIoTCarrier.h>
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(4);
ArduinoCloud.printDebugInfo();
counter = 0;
ArduinoCloud.update();
}
void loop() {
//redo tests around this for case 2 now that we removed the setup delay
Serial.println("Calling update....");
if(counter < 9){
counter ++;
}
else{
counter = 0;
}
delay(500);
ArduinoCloud.update(); //crashes here with no internet after a while, makes no effort to reconnect to cloud even after reintroducing the wifi
Serial.println("Updated!");
}
/*
Since Counter is READ_WRITE variable, onCounterChange() is
executed every time a new value is received from IoT Cloud.
*/
void onCounterChange() {
// Add your code here to act upon Counter change
}
Sketch is very basic, it should not depend on it. No internet for a while means (seconds, minutes, hours) ?
While it keeps running, it lasts for about 0.5- 1 minute before the stopping point immediately after internet is lost.
It does not happen... I've tested with my router and my phone as AP. The strange thing is as soon as I remove the internet connection in my logs this appears:
17:23:56.224 -> Update
17:23:56.224 -> ArduinoIoTCloudTCP::handle_Disconnect MQTT client connection lost
17:23:56.256 -> Disconnected from Arduino IoT Cloud
17:23:56.256 -> Update
17:23:56.256 -> Update
17:23:57.286 -> TimeServiceClass::getRemoteTime cannot get time from NTP, fallback on connection handler
17:23:57.286 -> TimeServiceClass::getRemoteTime cannot get time from connection handler
17:23:57.286 -> ArduinoIoTCloudTCP::handle_SyncTime could not get valid time. Retrying now.
17:23:57.286 -> Update
17:23:57.286 -> Update
17:23:58.285 -> TimeServiceClass::getRemoteTime cannot get time from NTP, fallback on connection handler
17:23:58.285 -> TimeServiceClass::getRemoteTime cannot get time from connection handler
17:23:58.285 -> ArduinoIoTCloudTCP::handle_SyncTime could not get valid time. Retrying now.
17:23:58.285 -> Update
17:23:58.285 -> Update
and then when internet comes back again
17:26:44.006 -> TimeServiceClass::sync done. Drift: -4 RTC value: 1739982404
17:26:47.260 -> Update
17:26:47.645 -> Connected to Arduino IoT Cloud
17:26:47.645 -> Thing ID: 434d4bfa-2103-412a-86f2-71eb78c7d8cc
I do not see the disconnection message in your logs...
Do you have an IoTCarrier connected? what happens if you disconnect it? Would you try also to remove the MKRIoTCarrier include ?
I have an iotcarrier connected, yes. I could run some tests with the carrier removed if needed. On the topic of the disconnection log message, with the network setup that I had in which my board was connected to a mobile phone hotspot in which I can take the data connection out but not the hotspot there was absolutely no disconnection log message.
was the bug able to be replicated still?