Nano 33 IoT freezes on ArdionoCloud.begin

Hi,

I recently bought a Arduino Nano 33 IoT and I am an Arduino noob, so please don’t be rude if I am doing something obviously wrong. Just let me know.

I have problems connecting to the IoT Cloud. Sometimes it works, but more often than not it seems to freeze in the Setup method.

It seems to get stuck on the ArduinoCloud.begin(ArduinoIoTPreferredConnection);
because I can see output 4 turn on twice before nothing else happens.

Please let me know if there is something I am doing wrong.

This is my Setup-method.

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);
pinMode(heater1, OUTPUT);
pinMode(heater2, OUTPUT);
pinMode(coolantValve, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);

pinMode(button, INPUT);
pinMode(3, INPUT);

pinMode(A0, INPUT);//referens stop temp
pinMode(A1, INPUT);//M temp
pinMode(A2, INPUT);//C temp
pinMode(A3, INPUT);//CW temp
pinMode(A4, INPUT);//S temp
pinMode(A5, INPUT);//CW flow

digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(4, LOW);

// Defined in thingProperties.h
initProperties();

delay(500);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);

// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

delay(500);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);
/*
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);

delay(500);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);

ArduinoCloud.printDebugInfo();

delay(500);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);

}

Does the same problem happen if you run the sketch on your board with no external wiring, modules, shields, etc. connected to it?

Hi, Thank you for your reply. I just tried starting the board with only d4 connected and then it works.

What can cause this? It works some times it seems.

I will reconnect my peripherals one at the time to see what is causing this whe I get back from work.

Thanks again for your suggestion!

Best regards

Pins A4 and A5 on the Nano 33 IoT are used to communicate with the crypto chip (on the I2C bus). The crypto chip is used to provide secure communication between the Nano 33 IoT and the Arduino IoT Cloud server. Using other than I2C devices to A4 and A5 can interfere with the communication with the crypto chip. So I suspect that's the problem. If so, you should be able to narrow it down to the A4 and A5 connections during your troubleshooting process.

Either way, at least now you can get a working and a non-working state. That's a good position to be in for troubleshooting.

Thank you so much!

I had input A4 connected to a potentiometer and it was set to a low value. When I disconnected it everything worked like a charm.

Thanks again!

You're welcome. I'm glad to hear it's working now. Enjoy! Per