MKR1010 board stuck offline. Sketch tab shows "No associated device found'. It was working before

I am using the Arduino MKR1010 board. It seems to be stuck offline.

It was working fine on Port 4 before.

I had changed to a different WiFi, and after returning home i switched back to my home WiFi. Now the board seems to connect on Port 6 of my PC. I don't know what caused this. I checked PC Device Manager. It shows that Port 3, 4 and 5 are in use. I don't know by what.

Using the web-based Full Editor, I successfully uploaded the sketch to my board.

However, on the IoT Cloud, Thing, Device, Sketch tab, it still shows my device is still offline. Serial Monitor does not work.

What should i do?

try to activate the bootloader with a double reset

Hi. Thanks for responding.

How do i activate the bootloader?

What is double reset? I don't understand.

By doing a double reset.

Press and release the button on your MKR WiFi 1010 board that is marked "RST" quickly twice. You should now see the "L" LED on the board pulsing, which means the bootloader is running. The double press causes the bootloader to run indefinitely (until the board is reset, powered off, or an upload is done).

The bootloader is a program on the ATSAMD21G18 microcontroller of the MKR WiFi 1010 that allows you to upload to the board over the USB cable. The bootloader program creates a virtual serial port on your computer, reads the data the computer sends to it during the upload, and then writes that data to the flash memory on the microcontroller so that it can run on the MKR WiFi 1010.

For this reason, the bootloader program must be activated during the upload process. The Arduino IDE does that automatically. However, it is possible for your sketch code to put the MKR WiFi 1010 into a state where the Arduino IDE is not able to communicate with the board in able to put it into bootloader mode. For this reason, it is useful to be able to manually activate the bootloader mode so that you can recover the board from that condition and upload a fresh sketch.

detailed as always Per :slight_smile:

1 Like

My co-workers have nicknamed me "-v".

1 Like

Hi. Thanks.

I did the double reset. I am using the MKR1010 board.

The LED_BUILTIN starts pulsating slowly, 2 second interval, fading on and off slowly.

The Sketch tab shows Port: COM5. I was expecting to see Port 4.

My sketch Verifies successfully. Uploads successfully. Then I get "No associated device found" in the Sketch tab.

So as you said there may be a problem with my sketch.

Woudl you look at my sketch?

/*

The following Cloud Variables are already declared in IoT Cloud: 
humidity
temperature
automatic
manual
mistingDuration
mistingInterval


*/



#include "thingProperties.h"
#include <DHT.h>
#include <DHT_U.h>

//int MistingDuration;
//int MistingInterval;

#define DHTPIN 6 // Pin A1
#define DHTTYPE DHT22 // DHT22 uses AM2302
DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor

float Humidity1; // current reading
float Humidity2; // previous reading
float HumiditySP; // Set Point
float Temperature1; // current reading
float Temperature2; // previous reading
float TemperatureSP; // Set Point

String Event;

unsigned long TimeCurrent = 0;
unsigned long TimeStart = 0;
unsigned long MistDuration = 5000;
unsigned long MistInterval = 1000;

int DOpump = 7;


void setup() {
  
  Serial.begin(9600);
  delay(5000);

  dht.begin();

  initProperties();

  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();

  pinMode(DOpump, OUTPUT); // misting pump
  pinMode(LED_BUILTIN, OUTPUT);

  Humidity1 = dht.readHumidity();
  Temperature1 = dht.readTemperature();
  humidity = Humidity1; // send value to Cloud Variable 
  temperature = Temperature1; // send value to Cloud Variable
  
  digitalWrite(DOpump, LOW);
  digitalWrite(LED_BUILTIN, LOW);

  Event = "SETUP complete";
  EventLog1();


}


void loop() {
  
  ArduinoCloud.update();

  TimeCurrent = millis();
  
  digitalWrite(LED_BUILTIN, HIGH); // show program is running
  delay(500);
  digitalWrite(LED_BUILTIN, LOW);

  if (((TimeCurrent - TimeStart) >= MistDuration)  && (pump) && (automatic)) {
    TimeStart = TimeCurrent;
    pump = false;
    digitalWrite(DOpump, LOW);
   
    Event = "Misting Completed. Pump STOP";
    EventLog1();
    
  }

  if (((TimeCurrent - TimeStart) >= MistInterval)  && (!pump) && (automatic)) {
    TimeStart = TimeCurrent;
    pump = true;
    digitalWrite(DOpump, HIGH);
    
    Event = "Interval Completed. Pump RUN";
    EventLog1();
    
  }
  

}


void onPumpChange()  {

  if (pump) {
    digitalWrite(DOpump, HIGH);
    
    Event = "Manual PUMP START";
    EventLog1();
    
  }

  else {
    digitalWrite(DOpump, LOW);
    
    Event = "Manual PUMP STOP";
    EventLog1();
    
  }

}


void onAutomaticChange()  {

  if (automatic) {
    pump = true;
    digitalWrite(DOpump, HIGH);
    TimeStart = millis();
    
    Event = "Automatic PUMP START";
    EventLog1();
    
  }

  else {
    pump = false;
    digitalWrite(DOpump, LOW);
    TimeStart = millis();
    
    Event = "Automatic PUMP STOP";
    EventLog1();
    
  }

}


void onMistingDurationChange()  { // cloud variable.
  MistDuration = mistingDuration*1000; // convert min to micro-sec, send to board variable.
  Event = "Misting Duration adjusted";
  EventLog2();

}


void onMistingIntervalChange()  { // cloud variable.
  MistInterval = mistingInterval*60*1000; // convert min to micro-sec, send to board variable.
  Event = "Misting Interval adjusted";
  EventLog2();
  
}


void EventLog1() {
  Serial.print(TimeCurrent); Serial.print("  "); Serial.println(Event);
  Serial.print("Pump = "); Serial.println(pump);
  Serial.print("Humidity = "); Serial.println(humidity);
  Serial.print("Temperature = "); Serial.println(temperature);
  Serial.println();

}


void EventLog2() {
  Serial.print(TimeCurrent); Serial.print("  "); Serial.println(Event);
  Serial.print("mistingDuration, sec = "); Serial.println(mistingDuration);
  Serial.print("MistDuration, micro-sec = "); Serial.println(MistDuration);
  Serial.print("mistingInterval, min = "); Serial.println(mistingInterval);
  Serial.print("MistInterval, micro-sec = "); Serial.println(MistInterval);
  Serial.println();

}

It is expected that the board will have a different COM port number when it is in bootloader mode. It should switch back to the normal port number when the board goes back into the standard mode of running the sketch program.

The Arduino IDE is able to automatically handle this port number change during the upload.

There is a simple test you can do. Please try this:

Select File > New from the Arduino IDE menus. You will now have the bare minimum sketch that is just an empty setup and loop function. We know for certain that this is a good sketch that should work perfectly. Even though it doesn't appear to do much, under the hood there is actually all the USB code that generates the CDC serial port for the board. The important part is that there is nothing in the sketch code that can break that lower level USB code.

Do the double reset to put the MKR WiFi 1010 into bootloader mode.

Upload the bare minimum sketch to the MKR WiFi 1010.

Does the problem still occur? If no, then you will know for certain that it is related to something in your real sketch.

OK. Thanks. Good point.

I suspected that he had a split personality :laughing: Actually 3 personalities, I think.

1 Like

@ashoka58sg Since you are using the IoT cloud, delete MKR1010 board as a Device and then install the latest Arduino Create Agent, see https://support.arduino.cc/hc/en-us/articles/360014869820-How-to-install-the-Arduino-Create-Agent .
After installing the agent, add a new device (MKR1010) and associate it with your project.