Page 1 of 1

USB device in a W10 Guest disappears as soon as it is used.

Posted: 16. Jan 2021, 18:54
by _BeepBeep
Hello,

I am using VirtualBox version 6.1.16 r140961 (Qt5.6.2) installed on a Windows 10 (version 20H2). I created a Windows 10 Guest OS (version 20H2). This virtual machine, is intended to receive the Open System Workbench IDE for STM32 microcontroller. I configured a USB connection (VID filter: 0483, PID: 3752) intended for the connection of the ST-LINK V2 module of a NUCLEO-F446RE Development Board from STMicroelectronics.

When I connect the module, everything seems to be going right, a COM port (STMicroelectronics STLink Virtual COM Port) and a new peripheral USB device named ST-Link Debug are shown in the device manager.

However, when I run "STLinkUpgrade.exe" program (used to check and upgrade the ST-Link firmware), ST-LinkUpgrade program declares that it has not found ST-Link device (No ST-Link found after GoToUsbLoader command) and the device manager no longer shows a COM port associate the ST-Link device! But If I do that on the host machine, I don't encounter any trouble, all works fine.

Question: Can I what I want to do (connect & debug STM32 dev board from a VM env.) work with VirtualBox? If so, what leads can you give me to try to fix this problem? Why does the COM port associated with the ST-Link module suddenly disappear? I did not find any information about that in the Windows event logger.
Thanks for your help.

Re: USB device in a W10 Guest disappears as soon as it is used.

Posted: 17. Jan 2021, 11:05
by mpack
Usually this means that it's a composite device and your USB filter is too narrowly defined - or not present at all.

Why not simply use the host to update the firmware in that tool? I too own an ST STLink v2 tool (genuine, not a cheap eBay clone), updating the firmware is something I've only ever needed to do once I think.

Re: USB device in a W10 Guest disappears as soon as it is used.

Posted: 20. Jan 2021, 20:55
by _BeepBeep
Thank you for your reply. My ST-Link module is a genuine STM module since it is the module available on NUCLEO development boards.
You are right, I did the firmware update by direct connection to the host first, and it worked great. As I said, I only ran the virtual machine update module, just as a test, to verify that everything was fine, and that was my mistake.

Your remark on the fact that the peripheral can present several facets is an interesting track because it is indeed the case; When updating the firmware, you can choose between 2 options:
STM32 Debug + VCP.
STM32 Debug + VCP + Mass storage.

In fact, the problem only had appeared with the firmware update application (STLinkUpgrade.exe or STLinkUpgrade.jar), which I used to verify that everything was fine. I wouldn't have written this post if I had done more testing! :oops:
Indeed, I was able to verify - without changing anything - that I could download and debug a program. However, in order for the STLinkUpgrade application to work properly, I have to remove all data from the filter.

So I was worried about nothing. I confirm that it is quite possible to download and debug a program in an STM32 NUCLEO module and even update the firmware, from a virtual machine with VirtualBox 6.1. For that, you must not declare a filter, and it works.

Thank you for your help which allowed me to move forward in solving this difficulty.

Re: USB device in a W10 Guest disappears as soon as it is used.

Posted: 21. Jan 2021, 14:01
by mpack
_BeepBeep wrote:For that, you must not declare a filter, and it works.
A non-existing or completely blank filter can be a bad idea.

With no filter the host gets first dibs on any new USB connection and may not be willing to give it up. Obviously if this has not (for the moment) proved to be a problem for you then good on you.

Grabbing the USB device with a blank filter essentially grabs the first USB device it finds. You can find yourself without (say) a host keyboard, because the VM now owns it.

Normally a filter that just e.g. specifies the manufacturer ID ought to be enough to avoid most problems.