Arduino upload issues

Hello,

I wanted to try VirtualHere on combination of RaspberryPi 3 for server (most recent firmware and up to date standard raspbian) and MacOS Monterrey as client (both Intel and M1 versions).

Installation and port autodetection went smoothly, but unfortunately sketch uploading always fails and leaves arduino in some weird state after which I need to connect it physically to MacOS machine and program it there. This is debug log when uploading sketch:

Arduino: 1.8.19 (Mac OS X), Board: "Arduino MKRZERO"

Sketch uses 11116 bytes (4%) of program storage space. Maximum is 262144 bytes.
Global variables use 2400 bytes (7%) of dynamic memory, leaving 30368 bytes for local variables. Maximum is 32768 bytes.
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem80101
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } / {/dev/cu.Bluetooth-Incoming-Port, /dev/cu.usbmodem80101, /dev/cu.wlan-debug, /dev/tty.Bluetooth-Incoming-Port, /dev/tty.usbmodem80101, /dev/tty.wlan-debug, } => {}
Uploading using selected port: /dev/cu.usbmodem80101
/Users/bruno/Library/Arduino15/packages/arduino/tools/bossac/1.7.0-arduino3/bossac -i -d --port=cu.usbmodem80101 -U true -i -e -w -v /var/folders/j3/f8v6b6d10fd81bt2qrq8fqf80000gn/T/arduino_build_325443/Blink.ino.bin -R
Set binary mode
An error occurred while uploading the sketch
No device found on cu.usbmodem80101
Send auto-baud
Set binary mode

I suppose some sort of detaching happens happens mid process which leaves the device hanging and breaks the process. After the process fails, device is still visible both in Arduino IDE and in MacOS USB devices. If there is a solution for this, I think I will happily buy the license.

Thanks,
Bruno

#2

Is it possible to test this with a windows client instead of mac?

#3

Yes, I have just done it. Problem mostly persists and here's what I discovered:
1 out of 5 times uploading sketch actually worked

Remaining times these would happen:
- after upload starts VirtualHere client just disconnects device (after putting it in programming mode which is visible by onboard LED) and upload hangs for ~10 seconds until it fails saying that there's no device connected
- after obtaining it for usage again, it usually gets a new COM port designation (switching from com 3 to 5 and vice versa in my case)
- then I repeat everything again and sometimes it works
- Interestingly, when upload starts and device gets disconnected, I can quickly double click on it in Client and obtain it before arduino IDE times out. Then uploading also succeeds. Sometimes even with COM port being changed. I suppose Arduino IDE is smart enough to just pick up a new COM port and continue
- Also most of the times after uploading is done, device again gets disconnected.

I used "Auto use device/port" as well, but I'm not sure if it helps or not.

#4

OK it sounds like the chip might be going info DFU mode or something. VirtualHere doesnt really support that.

You could try these two things

1. Make sure to check Auto-Use Port in the virtualhere client for that device by right clicking on it and selecting that

2. Stop the virtualhere server on the pi and add the line to the virtualhere server config.ini file

ClaimPorts=1

Unplug the arduino then replug it in again. Start the virtualhere server again and see if that resolves it.

#5

I tried it - no changes. On Windows it is still semi usable if I catch it fast enough and reattach port within client, and on MacOS unusable.

#6

Similar issue is seen on other boards which have VirtualSerial port (MKR1000,MKR1010,Leonardo,Micro,Nano33IoT,Nano33BLE) irrespective of the OS
The issue I feel is Arduino does a reset before upload which puts the board into bootloader mode
.
.
Forcing reset using 1200bps open/close on port COM12
.
.
And at this point the device gets disconnected.
Now, doing an Auto-Use Device doesn't bring the board back in bootloader mode. Hence, this solution wouldn't work.

@Michael: Any suggestions to overcome this issue ?

#7

No virtualhere doesnt support DFU mode