ProjetVSC

Arduino-Howto-VSC-02-SerialCOM Whit Hyper V

1 Goal 1

2 Setup an Arduino programmer on a Virtual machine 2

2.1 SERIAL COM MAP with CHANGE PORT 3

2.2 SERIAL COM MAP with VSPE 3

2.3 Upload Squetch 4

3 VM : SERIAL with Pipe 5

4 Pipe 2 COM 6

4.1 NP2COM 6

4.2 Check COM in the VM 6

4.3 VM SERIAL 6

4.4 Check COM with Arduino 8

4.4.1 Baud Rate 8

5 Serial with RDP 9

Goal

The goal is to use a USB Serial connected on a Hyper V Host for a VM.

There are several solutions and it depends of the program which can detect serial in device manager or in registry.

Setup an Arduino programmer on a Virtual machine

The Physical COM port to program the Arduino is on the Host Machine (W2012) and detected as “COM4”

Make a RDP with Port activated as Local resources :

On the VM, it is not detected in Device Manager , but can be checked in registry :

You can also see that COM 4 in the VM is linked to TSclient COM4 (it is a rdpDrPort):

Some program like IDE Arduino can use dieectly the COM4. So, there is nothing to do.

But other program like VSC can’t detect the COM 4 as it isn’t detected in Device manager.

SERIAL COM MAP with CHANGE PORT

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/change-port

change port [<portX>=<portY>| /d <portX> | /query

You can MAP a serial with the command : change port COM1=COM4

SERIAL COM MAP with VSPE

In the VM, create a MAP between PORT 1 and port 4 : http://www.eterlogic.com/Products.VSPE.html

Now, you can see that COM1 is linked to COM 4 :

Upload Squetch

With VSC, upload squetch : it works

VM : SERIAL with Pipe

change port /query

Create a pipe with the VM stopped.

Shutdown the VM

Set-VMComPort -VMName W2019-DEV -Number 1

Path: \\ .\pipe\SERIAL1 (it’s a arbitrary name : give a name to a new pipe on the host).

Set-VMComPort -VMName W2019-DEV -Number 2 \\.\pipe\PipeDream2

Check the port created :

Get-VMComPort -VMName W2019-DEV

I don’t think I was able to make a serial connection with pipe. It doesn’t work

Pipe 2 COM

NP2COM

On the Host Hyper V start c:\Program1\NP2COM\NP2COMV.exe

Select the pipe + select the correct baud rate and click on testing :

Check COM in the VM

Check that the RDP on the VM doesn’t have the option PORT select (to avoid conflict) :

VM SERIAL

Test with Kitty

Install as a service :

c:\windows\microsoft.net\framework\v4.0.30319\installutil.exe -t c:\Program1\NP2COM\NP2COMS.exe

Check COM with Arduino

Baud Rate

The first think is to know the baud rate of Arduino Board.

Start Kitty on the Host HyperV and select baud rate to be able to read the Serial from arduino board : 115000

On the VM , I don’t get something correct at the same speed : 115000

In the setting NP2COM, it is not correct

Restart service :

Now, it is correct :

Conclusion : change baud rate setting in IDE Arduino or KITTY is not important as it is fixed in the NP2COM

Unfortunately, I was never able to download a squetch with Arduino IDE.

Serial with RDP

Connect with Port enable in Local resources :

COM 4 not detected with Hardware manager :

But detected in Registry :

With Arduino IDE, the Serail COM 4 can be selected :

Flash done :