I am trying to upload a sketch with visual studio code with a macbook. It worked once but i don’t know anymore what the settings were. I thought it was: writing this line “upload_port = /dev/cu.whusbserial1420” in the file platform.ini, but it doesn’t work anymore.
the error is “couldn’t open port /dev/cu.whusbserial1420 No such file or directory: /dev/cu.whusbserial1420
However i can see what is going on on the serial monitor if i uploaded the sketch with the arduino ide
I can upload the sketch with the arduino application without any problems.
With VS Code, you don’t need to specify the COM port. It automatically detects the port.
So, you shouldn’t need to include that line.
Remove that line and try again.
I have tried it again without specifying the COM port, but it doesn’t make any difference. That was also the way i started.
I use a MacBook Pro and have never had to specify which driver to use. One thing that you can’t do is have both the Arduino IDE and PIO open at the same time. Whichever one opens first gets the driver so it is not available to the other.
It also doesn’t make any difference Steve.
I also have another laptop were Ubuntu is running en on that machine it doesn’t make any difference if i put the line “upload_port = /dev/ttyUSB0” in the platformio.ini or not, it works al the time.
The strange thing with my mac is that he doesn’t autodetect this port”/dev/cu.whusbserial1410″. This is the port my arduino environment uses.
the message i get
*** [upload] could not open port /dev/cu.usbserial-1410: [Errno 16] Resource busy: ‘/dev/cu.usbserial-1410’
Wen i put this line in the platformio.ine
upload_port = /dev/cu.whusbserial1420
i get this
Use manually specified: /dev/cu.whusbserial1420
*** [upload] could not open port /dev/cu.whusbserial1420: [Errno 2] No such file or directory: ‘/dev/cu.whusbserial1420′
why does he autodetect another port as the arduino environment
The “Resource busy” message usually means that the serial port is being used by another program.
Maybe your Mac is running some sort of software that is listening on that port on the background?
Can you take a look at these discussions and see if any of the suggestions solves your issue?
I know now wat the problem is, but am stil not able to solve it with the links Sara send me. (thanks for that)
I have more nodemcu’s and arduino’s and some of them i can upload and some not. Probably a driver problem.
But at least i can go on with the ebook on my mac
/dev is where drivers are stored. You can check if the file exists by going into terminal and typing
sudo ls -al /dev
It looks like it auto detected driver ‘/dev/cu.usbserial-1410’ but your manually specified driver is ‘/dev/cu.whusbserial1420′. Note one has a dash and the other doesn’t and one is 1410 and the other is 1420. I would say the 1410 one is correct as you get the busy error. As Sara says some other application is using that port (Normally Arduino IDE).
Have you installed two versions of the driver? In the “PIO Home” tab of VSCode you should see a “Devices” section on the left. This should show all available drivers. What do you have there? Also, in System report under USB, do you see a USB to UART device?
Under devices i see only “/dev/cu.Bluetooth-Incoming-Port”
When i go to the arduino environment i see “/dev/cu.usbserial-001” with the nodemcu that i can upload in Visual studio, and then also i see in Visual studio that he automatic choose the right driver.
When i connect the bad nodemcu i see “/dev/cu.usbserial-1420” and “/dev/cu.wchusbserial1420” in the arduino environment. Why do i see 2? The arduino environment uploads correct when i choose “/dev/cu.wchusbserial1420”
I didn’t install any driver so far i know.
Where can i find System report?
The /dev command doesn’t make sense for me i can’t see a driver’s name which i can recognize
I found this Article which is directly on point. See if it helps.
BTW. System report is part of about this Mac in the Apple menu.
im thinking the reason you see two is one is the Apple built in driver and the other is the board driver which conflicts. See the article.
i have tried several times what was in the Article you send me Steve, with no result.
Even worse, now i am missing a menu “project task” in visual studio. I tried to remove en install visual studio again but i can’t get the menu back.
edit: Oeps i doesn’t know how i did but know everything is working again. At least i was trying to remove everything and install everything again, and i had to make a new project to see the “project task”
Many thanks Steve
I also uninstalled the WCH driver as recommended in the link.
I hate it when that happens. I kinda had the same trouble. My home iMac died (it was 2009 vintage so had a good run with her) so the only Mac I have now is my work MacBook Pro. Unfortunately it’s locked down pretty good and I have to use the work proxy server. Whatever I did I could not get PIO to install via the proxy. Then one day it just started working and I have no idea why. I’m not going to delete nor reinstall it as I don’t know if it will work again.
I’m now waiting on these new Apple Silicon Mac’s to see which to buy. I hope they will work with either Arduino IDE or VS Code/PIO. I’m hoping for a Mac mini as I now have a 32″ 4K monitor so don’t need a laptop.
Were you able to get everything working?
Steve, thank you for your input.
Yes i get everything working.
It’s a bit of a mystery how i did it. I thing your link
and this which steve send, did the job.
I didn’t dare to remove usbserial.kext, but i renamed it. I don’t know if that was wrong. but then i also removed visual studio code and installed it again.
Finally i didn’t see /dev/cu.whusbserial1420 in the arduino ide anymore only /dev/cu.usbserial-1410
Then everything worked fine in Visual Studio
Many thanks Sara en Steve