MKR ZERO + Atmel-ICE, Win11, IDE 2.1.1 fault

On Win10 (IDE 2.1.1) a simple (debug optimized) blink working fine.

The same hardware (MKR ZERO, USB cable, Atmel-ICE) on Win11 (other PC, IDE 2.1.1) when i press the Start Debug button, it's immediately followed up by a message that reads: "USB device not recognized" and "The last USB device you connected to this computer malfunctioned, and Windows does not recognize it.", the MKR board connection is lost.
The sketch upload working fine always...
Is there a win11 specific idea?

Well, It seems the error not Win11 specific.
On the same PC on a fresh Win10 partition the error is same. The MKR ZERO disconnecting when i press the debug button. The yellow row designator does not appear.
On the other pc (Win10) just sometimes disconnect the board, somtimes (it seems) working.
I tried several MKR ZERO boards. Each PC is 1-2 years old (has 16-32 GB RAM, 6-8 Intel/Ryzen cores).
It seems the debug features not too reliable yet...

Summarizing the error:

  1. The MKRZERO USB disconnect popup (in Win11) NOT an error.
    This phenomenon has deceived me, I thought it was part of a mistake.
  2. Following the review (Debugging SAM-Based Arduino® Boards with Atmel-ICE) when i press the Start Debugging button, the following happens:

    The yellow row marker does not appear, I can't step row-by-row with the Step Over button.

The same hardware (and debug) is working fine on PlatformIO. My Arduino project is big (more then 50 ino-s + libraries), I don't have time/mood to move the project...

It is there. Unfortunately the color selected for it in the theme you are using has very poor contrast against the background so it is difficult to see. But if you look closely you will see the line is slightly lighter gray than the background.

If you would like a more distinctive visual marker, try this:

  1. Select File > Preferences... from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Select "Dark High Contrast" from the "Theme" menu.
  3. Click the OK button.

You will now find the execution point is clearly marked with a brown box around the line in the editor.

I have now submitted a formal report about this to the IDE developers:

If you have a GitHub account, you can subscribe to that issue to get notifications of any new developments related to this subject:

image

Thank you for your help, but I think you're on wrong way:


It should be look like as in platformIO, It works well here.

In the Arduino IDE 2.1.1 I can't step row-by-row with the Step Over button!!

It looks like this in High Contrast theme:

When i press the Step Over button, does not step to the next row and i receive this error message:

Thread Warning: watch: eval. expression 'x' with no thread context. Using default

I assumed that by "yellow row marker" you meant the line highlight (which is yellow in color in your VS Code screenshot). But from your new screenshot now I wonder if maybe you mean the outline on the breakpoint (which I see should be colored according to the debugIcon.breakpointCurrentStackframeForeground theme component)? I see that Arduino IDE doesn't have the latter regardless of which theme is selected.

That is slightly unfortunate, but certainly not the end of the world, since the line highlight provides the same information. Just try the different theme as I suggested in my previous reply and I think you'll see what I mean.

Something you need to understand is that Arduino IDE is not VS Code. The Eclipse Theia IDE framework it is built on is based on VS Code, so there are intercompatibilities and UI similarities, but they are two different applications so you will also notice some differences. So don't get sidetracked if the behavior is slightly different from one to the other.

That is not an error message. It is a warning. So long as the default thread context is what you intended then there is no problem and you can safely ignore it.

I'm not able to reproduce it with my Zero (I don't own an Atmel-ICE):

step-over

I have seen it work well in Arduino IDE 2.1.1, It looked/worked exactly like this:
platformIO GIF 2023. 08. 23. 10-40-18

This is what my Arduino IDE do:
Arduini IDE GIF 2023. 08. 23. 10-40-18

Now do you understand my problem?

PS:
The same devices (MKRZERO, Atmel-ICE) on the same PC works well on platformIO, but doesn't work on Arduino IDE 2.1.1

PS2:
On the same PC on an another partition (fresh Win10) the same thing happens: works well on platformIO, doesn't work on Arduino IDE 2.1.1

PS3:
I tried on several PC:

  • on an older (Lenovo 4th gen Intel corei5, 8GB RAM, Win10) and a new one (Lenovo 10th gen intel corei6, 16GB RAM, Win10): working
    Lenovo GIF 2023. 08. 23. 14-43-11

  • on a new one (my ASUS AMD Ryzen 7 4800H, 32GB RAM, Win11) : not working

I have no idea Is there any significance the chipset type, but it seems so far only works on intel CPU

Thanks for the clarification!

I notice that on the machine where it doesn't work, the sketch is under a path that contains "extended" characters (I don't know if that is the right term, but hopefully you understand what I mean), whereas the path on the machine where it does work contains only basic ASCII characters (C:\wolf\Blink_debug).

In theory, any path supported by the file system should work in any application, but unfortunately in practice I often find that such characters in a path is the cause of misbehavior.

In addition, I notice it is under a folder named "Google Drive". Less common, but I also sometimes see cases where problems are finally tracked down to being associated with the use of a file from a cloud storage service.

As an experiment, please try this:

  1. Open the sketch you were having troubles with on the machine that was in the non-working state.
  2. Select File > Save As... from the Arduino IDE menus.
  3. Save the sketch to a path that doesn't have any potentially problematic characteristics.
    For example:
    C:\Blink_debug
    
  4. Check to make sure you have Sketch > Optimize for Debugging selected in the Arduino IDE menus.
  5. Select the appropriate board in Arduino IDE.
  6. Select Sketch > Verify/Compile from the Arduino IDE menus.
  7. Wait for the compilation to finish successfully.
  8. Click the "Start Debugging" button.

Does the debugger now work as expected?

WOODOO BLACK MAGIC :scream:
Your suggestion is working (and now comes the BLACK MAGIC):
(remark: i always using the Optimze for Debugging option)

  1. opening ino from long path (containing special characters): not working
  2. closing the IDE (and delete the folder with ino)
  3. opening ino from short path (C:\work\Blink_debug)
  4. Save As ino to the long path (containing special characters)
  5. closing IDE
  6. opening ino (again) from long parth (containing special characters): working :astonished:

It seems (to me) the save as do "something" good... :upside_down_face:

I noticed a weirdness:

When i open ino from the special characteristics path and set breakpoints, the BREAKPOINT path is the short (previous) path (yet it works...):

I hate the black magic, took two weeks out of my life...
...but I got to know the platformIO :nerd_face:

A proposal:
In the Debugging with the Arduino IDE 2 It would be worth noting that the Arduino board USB disconnect (during debug) is NOT error! Since it didn't work for me the debug AND a popup is continuously indicated it the USB disconnecting event, I went to wrong direction for a week...

I'm glad it is working now.

I guessed as much, but I make it a policy to be very comprehensive in the instructions I post while providing support here on the forum. Even if that step is obvious to you, it might not be to some of the many people who may find this thread while researching for an answer to related questions in the years to come.

That is very odd. I did some experimentation to try to find a way to produce this misbehavior, but the debugger managed to behave correctly despite my best efforts. The breakpoints are stored in the metadata associated with the sketch, but the association between the metadata and sketch is based on the sketch path, so breakpoints set in the original sketch are simply not present in the new sketch I generate via a "Save As..." operation.

Did you have the Serial Monitor view open in the bottom panel of Arduino IDE?

I remember that in older versions of Arduino IDE 2.x, it did repeatedly show a notification if the port was lost (as is expected while debugging a board like MKR Zero since the program that generates the USB CDC serial port is not running while execution is halted). But recent versions of Arduino IDE don't have that behavior. I just tried it out with 2.1.1 and did not experience any such notifications.

I used it for all my tests Arduino IDE 2.1.1. I have met the phenomenon on several tested PCs. Now I tried to catch it:

PS:
I used native USB ports and (powered) USB hub too, almost always appears the USB error popup on all tested PC.

From your screenshot I see now that the notification is coming from Windows rather than from Arduino IDE.

that's right
PS:
However, it is extremely deceptive if an unexpected event is accompanied (as in my case)

I think it would be helpful to add a note about this to the tutorial. You are welcome to submit a contributions for this improvement if you like. The tutorial source content is hosted in a public GitHub repository so you can submit a pull request in order to most efficiently accomplish this.

The tutorial source is hosted here:

General information about contributing to projects on GitHub via pull requests here:

https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests

1 Like

Thanks for the information!
As my time permits, willingly I will add the now clarified informations.

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