ESP32-DevKitC in Ubuntu on VirtualBox

DonPancoe
Posts: 5
Joined: Thu Mar 09, 2017 7:28 pm

ESP32-DevKitC in Ubuntu on VirtualBox

Postby DonPancoe » Thu Mar 09, 2017 7:48 pm

Hello, all. First post.

I am trying to get an Ubuntu VM running in VirtualBox to devote to ESP32 development. The ESP-IDF tool chain installed nicely and I was able to edit and compile the sample project, but I cannot flash it to the dev board because the on-board Silabs USB-serial adapter never seems to mount in Ubuntu as determined by the following command:

Code: Select all

dmesg | grep -i tty
The device disappears from the Windows 10 (host OS) device manager, so I do believe that VirtualBox is grabbing it, but it never appears in Ubuntu (actually, it did one time for about 30 seconds but I was never able to reproduce that result). I have installed the Silabs driver in the Ubuntu VM, I have installed Guest Additions in the VM and I have tried both specific and blank USB device filters in the VirtualBox settings. Generally, all my other USB devices work in the VM: laptop keyboard and trackpad, external keyboard and mouse, etc. Although, when I did try the blank device filter, the external keyboard and mouse stopped working in the VM.

Other VirtualBox-related but not ESP32-specifc forum posts imply that USB-serial devices are just not that stable in the environment, but I'd be interested to hear if anyone else has successfully gotten this working.

Thanks,
Don

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby ESP_Angus » Thu Mar 09, 2017 11:11 pm

I've been caught out when my version of the VirtualBox Extensions was wrong (the proprietary extensions are what provides USB support). However if you see a tick next to the "Silicon Labs CP2102..." entry under Devices -> USB, and the USB Controller is enabled under Settings -> USB, then it should pass it through OK.
DonPancoe wrote:I have installed the Silabs driver in the Ubuntu VM
Linux has had built-in support for CP2102 for a long time, so if your Ubuntu versions is less than 7-8 years old then it doesn't need a proprietary driver. In fact, it's quite possible the proprietary driver is the reason it's not showing up correctly as a serial port. Try removing it if you can.

DonPancoe
Posts: 5
Joined: Thu Mar 09, 2017 7:28 pm

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby DonPancoe » Fri Mar 10, 2017 5:26 pm

I tried installing the driver because it wasn't working initially, so I don't think that could be the original cause of the problem but it certainly could have complicated it further.

Here's another error I received that implies, to me, that VB is trying to pass the device to Ubuntu but that it is not mounting on the guest side. I'm seeing more Ubuntu forum threads saying that people had to recompile their Linux kernel to fix the problem. I had downloaded this pre-made image from OSBoxes.org, but if I have to recompile the whole thing, maybe I will just build a new one from scratch.

Image

DonPancoe
Posts: 5
Joined: Thu Mar 09, 2017 7:28 pm

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby DonPancoe » Sat Mar 11, 2017 8:59 pm

Well, I built a new Ubuntu 16.10 VM from scratch and still no joy. Even confirmed that CP210x support was already present.

By searching the text of the above error message, I found this forum post and, when I applied the listed fixes, got rid of the error. The Windows host registry did list a filter for USBPcap, which was probably installed by another dev board, debugger or packet sniffer dongle I had used in the past. I think that may have been conflicting with the VirtualBox USB filter.

I now have the Silabs adapter checked under the Devices > USB menu within the guest machine, but I still don't have the device actually mounting to Ubuntu yet. Now I have to think through all the other fixes I tried earlier to see which combination works. My best guess right now has to do with adding my root user to the virtualboxusers group and enabling that group to use the VB extensions. Will report further updates.

On a broader topic: once I get this Ubuntu ESP32_Dev VM working, could I just share the whole thing with the community, including ESP-IDF? I have no idea of what the various licenses involved have to say about that.

Thanks,
Don

DonPancoe
Posts: 5
Joined: Thu Mar 09, 2017 7:28 pm

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby DonPancoe » Sat Mar 11, 2017 10:22 pm

So close and yet so far...
Image
Not surprisingly, trying to run make flash after this results in...
Image
I'm going to step away from this for a little bit...

Don

erhardd
Posts: 17
Joined: Mon Dec 05, 2016 9:16 am

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby erhardd » Sun Mar 12, 2017 10:15 am

I see, you use the DevKitC.
Have you pushed down the "boot"-Button while programming? :)

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby rudi ;-) » Sun Mar 12, 2017 11:19 am

erhardd wrote:I see, you use the DevKitC.
Have you pushed down the "boot"-Button while programming? :)
sry no erhardd
if you forget to push the buttom
it looks like this:
1.png
1.png (6.29 KiB) Viewed 23889 times
in don's picture, there is "Could not open port {}"
message and this is
- the port is not available
-- cause the guest system used it in other application
-- cause, the host system blocks
-- cause, the host system used it itself
-- cause the host system has no port of this



DonPancoe wrote:So close and yet so far...
Image
Not surprisingly, trying to run make flash after this results in...
Image
I'm going to step away from this for a little bit...

Don



if you use a vm
be sure your host system ( ubuntu ) has privileg open and allowed
to use your hardware in the "guest" system ( ubuntu in vm )
example here a vm on windows ( host ) and using a ubuntu (guest)
and there is no privileg open and allowed hw peripheral
2.png
2.png (23.35 KiB) Viewed 23892 times

right click in the vm on the usb sysmbol right buttom corner
you see example this, that there is no given hw to the guest system

after select a hw and privileg to open and allowed
3.png
3.png (33.6 KiB) Viewed 23892 times
you see the hw in the guest system and you can use it.

from now, the host system has no privileg to use it
if you want use it again, you must deactivate in the VM system again.

if you have forget to close your hw serial in the HOST system
you can not use it in the GUEST system

your picture looks like
you have no serial adapter in the "GUEST" system


if you want install HW in the GUEST system
then you have to allow it in the HOST system first to install it in the GUEST system
for the serial drivers there are advanced packs from Oracle available
you must install usb pack for the "VM"

thats the sence of a VM sytsem

best wishes
rudi ;-)

btw:
i use here in this example DevKitC V2
you see no Silicon Labs CP 21xx or orther things in the Guest system
you see it in the HOST system, that "forward" the HW to the guest system
in my example with Windows as Hostsystem and Ubuntu as Guest System as "Sierra Wireless mini card"

like Angus say
in your example you use ubuntu as Host system
there is usually support for the Silicon Labs CP from kernel
if you want us it, you do not need ( you can not ) install an "extra driver" in the Guest system.
you allways do things over the HOST sytem first, for this, Oracle have advanced packs for USB2, USB3 and so on.


in my example ( Windows as Host system )
i must use the "windows name for com serials"
i can not use /dev/ttyUSB0
i must use COMx
right, also in the Guest system, i must use COMx not /dev/ttyUSB0
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

DonPancoe
Posts: 5
Joined: Thu Mar 09, 2017 7:28 pm

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby DonPancoe » Tue Mar 14, 2017 3:05 am

Thanks to Angus and Rudi for all the good information. I seem to have gotten it working consistently on a few tries.

BTW, I am using a Windows 10 host with an Ubuntu 16.10 guest, plus the latest VirtualBox, extensions and guest additions.

First, since I suspected a conflict with USBPcap as mentioned earlier, I uninstalled that. Not sure if it made a difference, but I'll record it here just in case.

Second, I noticed that there were two USB device descriptions that could fit the ESP32, so I included them both in my VBox filter just to be safe. I also checked on USB 3.0 since I believe that the USB port on my laptop that I am plugged into is USB 3.0.

So here are the VirtualBox USB filter settings that finally worked.
Image

When I started the VM with those filters, I was able to achieve this...
Image

Trying make flash again, it didn't work at first, but at least I saw a different result...
Image

Searching Google for that text, I found a few permissions in the Ubuntu VM that I had to change:
  • Added my user to the dialout group
  • Added user to the tty group
  • Added user to the vboxusers group (did this a bit earlier)
  • Also added user to the vboxsf group, although that didn't directly apply to this issue
  • Added user permisions: "Use modems" and "Use VirtualBox virtualization solutions."
Finally, make flash worked! My LED is blinking!

Lastly, for good measure, I installed Vim and modded the blinky code slightly to make it my own.

Olfox59
Posts: 23
Joined: Tue May 02, 2017 12:36 pm

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby Olfox59 » Tue May 02, 2017 12:42 pm

Hi ,

I met the same issue.

When i plug into my linux Mint installed on my second laptop it is recognize by the default driver without other installed driver.

But when i test through Virtual box ( windows 7 host, linux Mint 17.3 guest) even with filterering my device, it is not seen by the virtual box and not list into the /dev folder.

In windows i see in device panel Virtualbox appears so i guess it redirect device on linux.

I installed the good extension related to my virtul box version.

The own things is may be the addon you mentionned that i didn t installed.

Where do you find it and how did you install please ?

Thanks a lot :)

Olfox59
Posts: 23
Joined: Tue May 02, 2017 12:36 pm

Re: ESP32-DevKitC in Ubuntu on VirtualBox

Postby Olfox59 » Wed May 03, 2017 7:49 am

hi,

I found the issue.

In my case it was really linked to USBPcap installed by wireshark.

I just installed it in winodws in Control Panel\Programs\Programs and Features.

Who is online

Users browsing this forum: No registered users and 143 guests