You are not logged in.

#1 2015-11-05 07:57:51

Morosko
Member
Registered: 2015-11-05
Posts: 2

[SOLVED] Arduino over USB not working in VirtualBox

Hi,

I'm running Arch as my host system and Windows 7 in a VirtualBox. I want to use Atmel Studio with my Arduino Atmega 2560. To get the right USB Drivers for Win7 I've installed the Arduino IDE in the guest and shared my Arduino as USB Device. But when I try to install the right windows driver I get the error "Couldn't start the devie (Code 10)".

I've already tried to change the permissions of /dev/ttyACM0 (where my Arduino is mounted), but it doesn't make any difference. I've also noticed that when I share the device /dev/ttyACM0 vanishes. Is there any other point where virtualbox mounts the device?

Thanks smile

Solution: I found the solution for my problem today. I had to change the USB Controller under Machine Settings -> USB to USB 2.0 (EHCI) Controller. I guess the driver or the USB support does only work with version 2.0.

Maybe this will help in the future. Have a nice day.

Last edited by Morosko (2015-11-09 19:35:51)

Offline

#2 2015-11-05 16:30:42

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,583

Re: [SOLVED] Arduino over USB not working in VirtualBox

Welcome to Arch Linux.

I think you are trying to push a rope here.   First, may I ask if there is a reason why you need to run the IDE in a VM?  It is written in Java and the native version for Linux works perfectly.  And it looks almost identical to the Windows version.

When you say you share the device, I assume you mean you told VirtualBox to use that device.  At that point, it no longer is seen by userspace in Linux.  It is like it was unplugged from Arch, and was plugged into Windows.

On with the problem...  It appears you are not passing the ownership of the USB device to the VM, but rather are mounting it under Linux to /dev/ttyACM0.  That means you would have to tell Vitualbox to map a "COM" port to /dev/ttyACM0.  Then the Arduino IDE under windows would talk to that "COM" port.  There is a big problem here.   The Arduinos have two methods of implementing their "Serial" interfaces.  One is to use a real life FTDI serial to USB bridge chip.  Then, the Arduino processor uses actual serial communications to talk to that bridge chip.  Newer Arduinos, including (I think) the one you referenced don't actually use a separate FTDI chip.  They have intrinsic USB controllers and present themselves to the USB bus as a serial bridge, but the serial communications never actual go over a wire.  Streams on the Arduino are just directly converted to packets and are sent over USB.  The problem is that, unlike the older Arduinos, when the processor is reset, the USB stack vanishes as the USB bus disconnects. During the restart, the Arduino reconnects to the bus and enumeration and negotiation start anew.  This means that every time the device is reset, /dev/ttyACM0 will disappear and reappear.  The IDE itself understands this behavior and can deal with it.

This is bad.   This will confuse VirtualBox because the "File" (Pipe)  it had open and was forwarding to Windows disappears. It probably will not reestablish the link automatically.  On the other hand, it you have the device dedicated to the VM, that is fine, but when the disconnect occurs, it vanishes on the Windows side.  The rub is that when it reconnects, it shows up initially on the Linux side and will remain there until you share it again.

tl;dr:  With an Arduino that implements the serial to USB internally and is subject to disconnect reconnect every time you upload to it, using it inside a VM is a fools errand.

Last edited by ewaller (2015-11-05 16:33:00)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2015-11-05 20:38:39

Morosko
Member
Registered: 2015-11-05
Posts: 2

Re: [SOLVED] Arduino over USB not working in VirtualBox

Hi ewaller,

thanks for your reply. I want to go further and use Atmel Studio in the VM, but to get the right drivers I've installed the IDE. That's why I have to run the VM wink

Ok, I see the problem. Based on your reply I tried to set a "serial port pipe" in VirtualBox. Now my mircocontroller is available at COM1, but when I try to install the driver I still get this error message, which I've mentioned above. It seems to me like the virtual machine can't pass any data out to my mC, so I tried to change the permissions again, but no change..

What do I miss?

Thanks for helping smile

Last edited by Morosko (2015-11-05 21:00:11)

Offline

Board footer

Powered by FluxBB