SERIAL COM PORT and RDP on VM [SOLVED]

Dear,

I have installed PLatformIO in a Virtual Machine (W2012R2) which run on a HyperV W 2012 R2.
The physical USB Serial device is connected on the Host. It is detected as COM3.

On the host, I can run putty and manually type COM3 : I can see the string coming from my Arduino device.

I use RDP with the parameter “PORTS” checked in RDP Local resource.
On the VM, I start Putty and manually type COM3 : I can see the string comming from my Arduino device.
So, the serial port is working in the VM.

I also checked the COM3 with Aduino IDE which detect the port COM3. It work with Arduino IDE.

Unfortunately, PLatformIO doesn’t detect this port. I suppose this is because the COM port isn’t visible in “device Manager” of the VM. I can only see the COM port in REGEDIT.

Question : how can I force PLatformio to use COM3 : is it possible in a ini file?

Best Regards

I found that I can run monitor with this command : pio device monitor --port COM3
It works
Question : why COM 3 isn’t detected by PlatformIO.
How can I set COM3 as the SERIAL by default so I don’t need to use command line every time I need to do something?
It’s my first step with platformio and I don’t know if I’ll be able to download application in arduino device…
Thank for your advice.

Dear,

I made several test with PlatformIO installed on a HyperV Virtual Machine (VM).
As already explained , the issue is with the programmer Upload of the Arduino target (TinyUSB or ArduinoISP).

I can connect the HOST COM3 (which is a FTDI USB<>UART Breakout Board) on the VM in two different way :

  1. With RDP redirect option :

With this mode, the COM PORT isn’t show in device manager (normal with HyperV gen2) but I can see it in REGEDIT (HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM\device\VCP0=COM3)

I’m able to connect the COM3 with : PUTTY, Arduino IDE Monitor, PIO Monitor (if I set upload_port = COM3)
I’m able to program the target with Arduino IDE but not with PIO (I don’t know which parameter to program for COM)
pio device list Show nothing

  1. With pipe redirection

In this case, I create a new pipe for the VM COM1 which is available on the host and I redirect this pipe to the HOST COM3
In this case, the COM1 in the VM is created in device manager.
For Arduino IDE, it detect COM1 and I can use monitor but Uplaod target doesn’t work.
For PIO I don’t need to set “upload_port = COM3” as it detect the COM1 in device manager. PIO monitor is working well, but not upload.
Putty is working too.
After test, this mode seems worse than standard RDP redirection.
But I can see COM with command :

pio device list
COM1
Hardware ID: ACPI\PNP0501\1
Description: Communications Port (COM1)

COM2
Hardware ID: ACPI\PNP0501\2
Description: Communications Port (COM2)

Conclusion :
As it work for Arduino IDE, the first solution (RDP redirection) should work.
But PIO device list only detect device manager COM port and doesn’t work with avrdude…

avrdude: Error: Invalid -P value: 'ACPI\PNP0501\1’
avrdude: Error: Invalid -P value: ‘COM1’

Can you advice ?

I finally managed to make it work.

The problem is that the baudrate need to be specified too.
Otherwhise you receive message like this :

Looking for upload port…
Use manually specified: COM3
Uploading .pioenvs\moteino\firmware.hex
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

I set following parameter and it upload now :

[env:moteino]
platform = atmelavr
board = moteino
framework = arduino
upload_speed = 57600
upload_port = COM3
upload_protocol = arduino

Best regards

I see that upload speed is disabled. Does it work with 115200?

Oups, it’s a mistake.
It work only if I set upload_speed to 57600. I didn’t try 115200.

Is it possible to have a monitor_port + Monitor_speed ?
It’s annoying to wait the popup and select COM port (more, I can’t select COM3 because this virtual port is not in device Manager)

Thanks, fixed

We have a feature request for that

Please file a feature request here Issues · platformio/platformio-atom-ide · GitHub
We will add custom input where you can set custom port and PIO IDE will remember it.

I am using MACOS 10.12.5 , ATOM 1.18.0 , PlatformIO, version 3.5.0a4 and Moteino R5-USB .

I faced the same problem when loading the software

Looking for upload port…
Auto-detected: /dev/cu.usbserial-DA01I8AV
Uploading .pioenvs/moteino/firmware.hex
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xbc
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xad
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x1d
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x09
avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x09
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xbc
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xad
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x1d
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x0a
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xbc

avrdude done. Thank you.
*** [upload] Error 1
========================== [ERROR] Took 17.60 seconds ==========================

but after some investigation I managed to find the moteino.json file in ~/.platformio/platforms/atmelavr/boards

and changed the “speed”: 57600 to “speed”: 115200 and it started working.

I now understand the problem, and it could be fixed using the upload_speed=115200 on config file platformio.ini.

{
“build”: {
“core”: “arduino”,
“extra_flags”: “-DARDUINO_ARCH_AVR -DARDUINO_AVR_MOTEINO”,
“f_cpu”: “16000000L”,
“mcu”: “atmega328p”,
“variant”: “standard”
},
“frameworks”: [
“arduino”
],
“name”: “LowPowerLab Moteino”,
“upload”: {
“maximum_ram_size”: 2048,
“maximum_size”: 31744,
“protocol”: “arduino”,
“require_upload_port”: true,
“speed”: 115200
},
“url”: “Moteino”,
“vendor”: “LowPowerLab”
}

Hope this can help someone else that may face the same problem.

Thanks, I reverted back previous upload speed

To MAP a serial port in a VM which is not detected in Device manager (so can’t be used in VSC)
The solutions to map such SERIAL port to SERIAL 1 with the command :

change port [=| /d | /query

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