Notifications
Clear all

Visual Studio error.

12 Posts
3 Users
1 Likes
1,085 Views
(@donnor)
Member
Joined: 2 years ago
Posts: 22
Topic starter  

I am getting this error when attemting to upload a project in Visual Studio.

Error: Please specify `upload_port` for environment or use global `--upload-port` option.

I am under the impression the port is found automatically.

Thanks for any help. 


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6932
 

Posted by: @donnor

I am getting this error when attemting to upload a project in Visual Studio.

Error: Please specify `upload_port` for environment or use global `--upload-port` option.

I am under the impression the port is found automatically.

Thanks for any help. 

The error is self explanatory. It is NOT automatic, you must specify it. Since I don't use and don't know anyone that does I have no idea how you do that, it's trivial in the arduino IDE.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@donnor)
Member
Joined: 2 years ago
Posts: 22
Topic starter  

I am refering to Visual Studio IDE. Not the Arduino IDE. I know you have to select the port in Arduino. The port is supposed to be selected automatically in VS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6932
 

@donnor Ok then, problem solved.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1670
 

Hi @donnor,

   By VS Code, I assume you are referring to the Platformio extension. I am also assuming you are using Windows in my discussion below ... the overall message would probably be the same for Linux or Apple, but the corrective steps would differ in detail.

  I haven't yet used Platformio in the way you are, but I did do a quick Google, which might offer a clue:

https://community.platformio.org/t/error-please-specify-upload-port/26218

The discussion is a little muddled, but I interpret the gist of the solution consists of two parts:

  1. Install an appropriate USB driver for the USB to JTAG board. That is, with the USB plugged in, go to Windows Device Manager (sometimes found via Control Panel) and ensure your USB device has been recognised, and assigned a COMx port where x could be 1,2,3,4, 5... etc.
    • The 'danger sign' is one or more USB devices with a yellow exclaimation sign ... which typically means you need to install the correct driver. In the reference above, this was for CP210x USB device, but there are many other devices around, each needing their own flavour of driver. If you check the Properties of the complaining device, it will usually give a clue as to what to look for, and Google can be your friend.
    • When the correct device deriver is installed, look under the Ports (COM & LPT), for the the USB with a COMx designation ... e.g. USB Serial Port (COM4)
  2. Enter a line like "upload_port = COM[4]" into the Platformio.ini file, obviously matching the COM[x] value to the value shown in the Devce Manager.

------

As I said, I haven't used Platformio in this way yet, so my interpretation may be flawed, but I hope it will be enough for you to figure out a solution.

Best wishes,

Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6932
 

@donnor You are talking to the wrong folks, you need to talk to the VS support team.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@donnor)
Member
Joined: 2 years ago
Posts: 22
Topic starter  

Thanks. I am starting to think there is a problem with my computer as the com ports do not show in the device manager up even for my printer, but the printer works. I'm going to try another computer and see how it goes there.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1670
 

Hi @donnor,

  Trying another computer is always a good idea. Also, if the computer has more than 1 socket, try the other ones .... not all sockets are created equal!

  With Windows, if you watch in the Device Manager, whilst plugging in or removing a USB device, you will normally see the device being added or removed. With USB to FTDI/Serial devices, it is common to need to add a device driver, but it should still appear with an exclaimation mark, indicating it needs a device driver.

Linux also puts messages in its log when a USB device is plugged in, the content of which indicates whether it was successful or not. There are some 'classic' reasons why it sees the device, but is unable to link up with it properly. One situation results in a series of lines in the log file, collected over a few seconds, initially suggesting it will be successful, but then indicating why it subsequently failed.

Sorry, I am not familiar with Apple kit.

--------

Of course, USB sockets, plugs, cables, USB adapters, etc. can all electrically fail.

In terms of searching and asking for help, I am pretty sure this is related to Platformio, not VS Code, but the main issue is more likely to be the USB device and its associated device driver. Regarding this as VS Code problem is likely to reduce the chance of finding a solution ... start at the USB device ...

With either Windows or Linux, it should be possible to identify the associated virtual COM port 'device' when the USB device is plugged in, regardless of whether VS code is even installed. Once you have tracked the COM port down, hopefully it is just a case of adding the appropriate line in Platformio.ini to bring it all together.

Good luck, Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6932
 

@davee Playing a wild hunch here. I don't have windows or I would do this but if you could screen print what your COM ports look like in Device Manager WITH context, ie what is above and below in the tree. My hunch is the OP is looking in the wrong part of the tree as I have a recollection there are two parts of the device tree associated with USB/COM devices.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1670
 

Hi Ron @zander and @donnor,

   I am writing this on an old laptop that I do not normally use for Arduino, etc., and initially it was showing the case with the exclaimation mark, indicating it had spotted a new USB device, but hadn't found a matching driver.

However, before I had captured a screen shot, Windows found a driver ... so all I captured is a couple of cases where it has identified a driver and assigned a COM port ... if only it was that easy every time! 🤨 

   A screenshot with a serial USB that is 'likely' to work looks like:

image

The important entry is the upper one, pointed to by the red arrow. This one is only visible whilst the USB device (in this case a 2560 Mega), is actually plugged into machine.

The lower entry, pointed to by the black arrow, are the computers own USB devices, which is shown in the 'collapsed' view ... if I had clicked on the ">" it would expand to around a dozen hubs and controllers.

Changing to a USB-to-FTDI board for driving a ESP32 CAM changed the entry to:

image

Note the COM port is different .. I don't know how it is chosen .. just be suspicious of COM1, as that is often reserved for the internal computer use.

------------

For comparison of failing to find a driver, I did a quick Google, looking for a screenshot of USB device, which also proved problematic ... the nearest I found was unfortunately not in English, but I think you can get the general idea. It should say USB and have USB symbol, with the same yellow triangle and an exclaimation mark, indicating it hadn't found the correct driver.

image

-----

Also note, you may have a non-USB device with a yellow warning triangle associated with some (usually obscure) part of your computer, indicating you haven't got the full set of drivers. Fixing that may be good for your computer, but obviously will not address the main problem.

-------

Hope that helps a little.

Best wishes, Dave


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6932
 

@davee FYI @donnor That looks like something that will work, maybe now the OP can show us what he gets.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@donnor)
Member
Joined: 2 years ago
Posts: 22
Topic starter  

I have tried on another computer and all is well. Com ports show up in the device manager like expected to and I was able to download a project. Now to investigate the other machine. Thanks to all.


   
ReplyQuote