MKR 1500 NB reset loop

The long run of MKR 1500 NB issues continues with this...

My board is resetting shortly after connecting to the arduino IoT cloud,

It connects well until I try to add variables to it then it seems as if after I have added about 10 variables it will not stay running and eventually times out on the WDT (I am guessing).

Here is my code, there is no actual code apart from that which is generated by the setup of the 'Thing'

/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled 2"
  https://create.arduino.cc/cloud/things/b2a03e42-38d8-42eb-be23-89e15e6c254d 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  CloudColor dmx01;
  CloudColor dmx02;
  CloudColor dmx03;
  CloudColor pix01;
  CloudColor pix02;
  CloudColor pix03;
  int a01;
  int a02;
  int a03;
  int a04;
  int e01;
  int e02;
  int fairy01;

  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"

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(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  // Your code here 
}




/*
  Since Dmx01 is READ_WRITE variable, onDmx01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onDmx01Change()  {
  // Add your code here to act upon Dmx01 change
}





/*
  Since Dmx02 is READ_WRITE variable, onDmx02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onDmx02Change()  {
  // Add your code here to act upon Dmx02 change
}

/*
  Since Dmx03 is READ_WRITE variable, onDmx03Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onDmx03Change()  {
  // Add your code here to act upon Dmx03 change
}

/*
  Since Pix01 is READ_WRITE variable, onPix01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onPix01Change()  {
  // Add your code here to act upon Pix01 change
}

/*
  Since Pix02 is READ_WRITE variable, onPix02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onPix02Change()  {
  // Add your code here to act upon Pix02 change
}

/*
  Since Pix03 is READ_WRITE variable, onPix03Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onPix03Change()  {
  // Add your code here to act upon Pix03 change
}

/*
  Since Fairy01 is READ_WRITE variable, onFairy01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onFairy01Change()  {
  // Add your code here to act upon Fairy01 change
}

/*
  Since Power01 is READ_WRITE variable, onPower01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onPower01Change()  {
  // Add your code here to act upon Power01 change
}


/*
  Since E01 is READ_WRITE variable, onE01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onE01Change()  {
  // Add your code here to act upon E01 change
}

/*
  Since E02 is READ_WRITE variable, onE02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onE02Change()  {
  // Add your code here to act upon E02 change
}

Surely it has more capacity than this...

Best,

M

A little further diagnostics,

I have added some serial prints to the code, it appears the first time the board tries to run Arduino.cloud.update(); after the board has connected to the arduino IoT Cloud.

This is the serial monitor log I get...

yxyxyxyxyxyxyxyxyxyxSIM card ok
yxGPRS.attachGPRS(): 4
Connected to GPRS Network
yxTimeServiceClass::sync Drift: -3 RTC value: 1696909130
yxyxyxyxyxyxyxConnected to Arduino IoT Cloud
Thing ID: b2a03e42-38d8-42eb-be23-89e15e6c254d

After this, no more serial prints and the board resets, I am guessing due to the WDT

And here is my code...

/*
  Sketch generated by the Arduino IoT Cloud Thing "Untitled 2"
  https://create.arduino.cc/cloud/things/b2a03e42-38d8-42eb-be23-89e15e6c254d

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  CloudColor dmx01;
  CloudColor pix01;
  int a01;
  int a04;
  int c19;
  int e01;
  int e02;
  int l01;
  int v01;
  int v02;
  CloudSchedule hbSched;
  CloudSchedule onTime;
  bool hb01;
  bool power01;
  bool relay01;

  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"

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();
}

void loop() {

  Serial.print("x");
  ArduinoCloud.update();
  Serial.print("y");



}




/*
  Since Dmx01 is READ_WRITE variable, onDmx01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onDmx01Change()  {
  // Add your code here to act upon Dmx01 change
}





/*
  Since Dmx02 is READ_WRITE variable, onDmx02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onDmx02Change()  {
  // Add your code here to act upon Dmx02 change
}

/*
  Since Dmx03 is READ_WRITE variable, onDmx03Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onDmx03Change()  {
  // Add your code here to act upon Dmx03 change
}

/*
  Since Pix01 is READ_WRITE variable, onPix01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onPix01Change()  {
  // Add your code here to act upon Pix01 change
}

/*
  Since Pix02 is READ_WRITE variable, onPix02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onPix02Change()  {
  // Add your code here to act upon Pix02 change
}

/*
  Since Pix03 is READ_WRITE variable, onPix03Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onPix03Change()  {
  // Add your code here to act upon Pix03 change
}

/*
  Since Fairy01 is READ_WRITE variable, onFairy01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onFairy01Change()  {
  // Add your code here to act upon Fairy01 change
}

/*
  Since Power01 is READ_WRITE variable, onPower01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onPower01Change()  {
  // Add your code here to act upon Power01 change
}


/*
  Since E01 is READ_WRITE variable, onE01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onE01Change()  {
  // Add your code here to act upon E01 change
}

/*
  Since E02 is READ_WRITE variable, onE02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onE02Change()  {
  // Add your code here to act upon E02 change
}








/*
  Since A01 is READ_WRITE variable, onA01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onA01Change()  {
  // Add your code here to act upon A01 change
}

/*
  Since A02 is READ_WRITE variable, onA02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onA02Change()  {
  // Add your code here to act upon A02 change
}

/*
  Since A03 is READ_WRITE variable, onA03Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onA03Change()  {
  // Add your code here to act upon A03 change
}

/*
  Since A04 is READ_WRITE variable, onA04Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onA04Change()  {
  // Add your code here to act upon A04 change
}

/*
  Since L01 is READ_WRITE variable, onL01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onL01Change()  {
  // Add your code here to act upon L01 change
}

/*
  Since T01 is READ_WRITE variable, onT01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onT01Change()  {
  // Add your code here to act upon T01 change
}

/*
  Since T02 is READ_WRITE variable, onT02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onT02Change()  {
  // Add your code here to act upon T02 change
}

/*
  Since V01 is READ_WRITE variable, onV01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onV01Change()  {
  // Add your code here to act upon V01 change
}

/*
  Since V02 is READ_WRITE variable, onV02Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onV02Change()  {
  // Add your code here to act upon V02 change
}



















/*
  Since Colour is READ_WRITE variable, onColourChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onColourChange()  {
  // Add your code here to act upon Colour change
}





/*
  Since C19 is READ_WRITE variable, onC19Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onC19Change()  {
  // Add your code here to act upon C19 change
}




/*
  Since Relay01 is READ_WRITE variable, onRelay01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onRelay01Change()  {
  // Add your code here to act upon Relay01 change
}





/*
  Since OnTime is READ_WRITE variable, onOnTimeChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onOnTimeChange()  {
  // Add your code here to act upon OnTime change
}

/*
  Since HbSched is READ_WRITE variable, onHbSchedChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onHbSchedChange()  {
  // Add your code here to act upon HbSched change
}

/*
  Since Hb01 is READ_WRITE variable, onHb01Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onHb01Change()  {
  // Add your code here to act upon Hb01 change
}

I had a very similar problem happen. Did you make any edits to the Thing variables, or did you put them all in and it stopped working?
I have a short program that I can run with 12 Thing variables OK. When I add the 13th it does the reset with watchdog timer thing.

I had Arduino support try to help, but they said it was something I was doing wrong, yet like you I wasn't writing the code, all I was doing was adding or removing Thing variables.

After three weeks of trying and contacting Arduino support, I had to give up with their cloud because it just didn't work with my Thing variables.

I believe this is a bug in the cloud code which is very subtle and they have yet to find it or even try to find it.

In my test code, I could add a Thing variable and it would quit working, then remove the Thing variable and it would work again. Repeat and the same results. Arduino said it was something I was doing... Huh?

It doesn't seem to be the actual number of Thing variables that is the issue. I have been able to get 20 or more working OK, as long as I don't edit them, remove one, and then add one again. If for example, I add 15 Thing variables and then run the program it works OK. I just can't make any changes to the Thing variables.

I finally had to give up and find another way to write my app without using the Arduino cloud.
It just isn't working well enough for serious applications.

I am kind of glad you have verified the problem exists, but sorry you are having the same problem I had.

Hello @twesthoff,

Firstly, thank you very much for your reply, I really appreciate you taking the time to write this.

This is very interesting what you are saying,

I have noticed in the past that if you add a variable then change it's name that the chunk of generated code (function) that runs when the variable changes remains in the list...

void onHbSchedChange()  {
  // Add your code here to act upon HbSched change
}

I.e. if you were to change the name of this variable, it would leave the function for this variable in the list and would add a new one with the new name,

It occurred to me that the mechanism for editing was not doing proper clean up after, I will look into this more now. I hope this is the answer.

Thank you again so much,

M

The problem is very much a bug in the Arduino Cloud code. It is not anything you are doing wrong.

Somewhere in the Thing variable initialization code (not code you have written), it hangs up. Since your main loop never runs, the: ArduinoCloud.update(); never runs, so the watchdog timer resets the MKR NB 1500.

I found when this happens it can sometimes be difficult/impossible to upload a new sketch if it is large like mine was. Since the board keeps resetting every 16-20 seconds the compile and upload has to complete quickly. To solve this, I downloaded the example sketch "Blink". Since the program is small it compiled and downloaded before the watchdog timer reset the board.

For some reason the code that uploads a new sketch doesn't disable the watchdog.

I hope you find a way around the problem, I didn't. If you get it to work, let us know how you did it.

Thank you @twestoff,

I found that I had an issue uploading the code also, but if you double push the reset button quickly it puts the board into bootloader and will no longer reset, this allows you to upload your code.

Thank you again, hope I get somewhere and Arduino choose to give this some attention.

Best,

M

I had tried using two quick resets but it didn't work for me. I will try it again if I ever have that problem.

I hope the Arduino Cloud Thing variable problem will be fixed.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.