I have two Adafruit Metro M0 Express’ and both are behaving in the same manner. I take the most basic sketch and compile it without issues. When I try to upload to to the board if I do a reset (using the button on the board) it resets and goes to port “COM4” (for example). I can then upload, but when the uploads finishes it resets automatically and comes back on “COM5”. If I make changes and try to upload again it will wait indefinitely for the upload to start. If I do a reset, the board returns to “COM4” and everything works.
I am trying to get a Black Magic Probe to work with the board, works occasionally, but I believe I am hitting issues due to this reset issue.
Seems that the COM4/COM5 are just the USB-CDC devices opened by the bootloader and the application firmware to me.
For upload, it shouldn’t matter which of the two is running because PlatformIO (and the Arduino IDE) do a reset-to-bootloader procedure in which the USB-CDC device is opened at 1200 baud. When the bootloader or application firmware notices that, it reboots into bootloader mode and allows the upload.
Seems like that part isn’t working though for you. Please file an issue in Issues · platformio/platform-atmelsam · GitHub and link to this thread and add logs that are output when you upload the first time vs upload the second time, and the available COM devices.
As a workaround, by quickly double-tapping the reset button on the board, you always enter the bootloader mode and uploading should always work.