Today I tested some Code on the Arduino MKR Zero, uploaded a few sketches and then suddenly I lost USB connection between Arduino IDE and the Arduino board. The Arduino can not be recognized by the IDE anymore. If I wand to upload a sketch, the IDE says that no board is connected.
To decrease the number of possible error sources, I did the following:
restarted notebook and IDE (Windows)
connected Arduino to all my USB ports
tried another usb cable
other usb devices run without problems
My sketch tries to establish a connection between the Arduino MKR Zero and a sensor via UART (Serial1) and I tried to receive UART bytes per interrupt (SERCOM5_Handler()). At first I only wanted to log the data on serial monitor (Serial) so that I peeked the UART bytes and printed them to serial monitor. At times the program did the work and I saw sensor data on the serial monitor but one sketch upload then ptobably killed the arduino maybe. Since then the IDE could not reach the board.
My questions are:
which options are there to rescue the board?
is it so easy do destroy a board by pure software sketches?
which options do I have to analyse the fault source?
I hope someone knows the problem and can help me, thanks!
Watch the black console window at the bottom of the Arduino IDE window. As soon as it says something like "Sketch uses 9592 bytes (3%) of program storage space. Maximum is 262144 bytes.", press and release the reset button on the MKRZERO.
the USB is handled by tour sketch (in the part added by the Arduino core). if your sketch fails/hangs then USB is not handled. then the bootloader can do it. after double pressing the reset button the bootloader is active for 10 seconds and you have the port.
Juraj:
after the double reset you have the com port for 10 seconds, to upload a working sketch
No I don't have the com port. I wanted to upload an empty sketch to override the fault sketch with your method. But after double resetting the IDE didn't offer a COM port for 10 seconds. Uploading the sketch without choosing a COM port during the 10 seconds also fails.
Thomjay:
No I don't have the com port. I wanted to upload an empty sketch to override the fault sketch with your method. But after double resetting the IDE didn't offer a COM port for 10 seconds. Uploading the sketch without choosing a COM port during the 10 seconds also fails.
try to start the upload and then the double reset.
ballscrewbob:
When you say you dont have a COM port are you using windows 10 ?
If so some versions of windows 10 HIDE the COM ports and you need to re-enable the display in device manager using the SHOW HIDDEN DEVICES.
Yes I'm using windows 10.
But now I could test it with a second board (arduino micro). With the same USB cable at the same notebook I could upload a sketch without any problems. So I estimate the MKR Zero is dead. I must wait for a new MKR Zero a few days to upload my sensor sketch. But next time I won't use the SERCOM5_Handler() to receive any byte per interrupt. Instead I try to solve the problem with polling in serialEvent(). I'm not sure but I think it has something to do with it. Another thing could be that the sensor killed the Arduino..
What you haven't said is what happens in device manager ?
Does windows device manager show anything at all not necessarily a com port but a failed device of some sort ?
Does windows make the HARDWARE FOUND noise at all ?
If you have access to a good JTAG device you could try to reset the device and replace the bootloader.
in device manager nothing happened when using the MKR Zero. I deleted after your post all entries with COM ports. After connecting the device manager didn't change anything, no failed device or something like that. There was also no hardware sound after plug in.
With the new arduino micro, there is hardware sound and two new entries in device manager:
Arduino Micro (COM3)
Arduino Micro bootloader (COM4)
I don't have a JTAG device or another programmer, so replacing the bootloader is no option.