Upload works on Arduino IDE, but not on PlatformIO

Hello, I’ve bought an arduinoi nano clone (atmega 328P). When I upload the program via Arduino IDE everything works, but when I tried it with Platform IO it doesn’t upload. It doesn’t open the serial monitor neiter. So maybe sth with USB ?. With my orginal Arduino UNO board platform IO works well. What can it be?

Clipboard_10-07-2024_01

Set board = nanoatmega328new in the platformio.ini. The uploader baudate is different.

I did it already but still doesn’t work.

Is the COM port the same as you use in the Arduino IDE?

Hello.

Any update on this issue? I started to face the same problem recently all of a sudden after months of uploading flawlessly my Arduino Portenta H7.
The message I receive is this one:

On the web I have seen many answers to many similar cases having the same message but for different platforms, like ESP32. They say uninstall and reinstall the driver (CH341). Unfortunately that doesn’t work for me.

So I checked that a simple project can be uploaded from Arduino IDE after installing it on my machine. I thought after the installation Windows 10 will receive the best driver from the process, but guess… nothing changed on the PlatformIO side. I get the same error.

I just can read from the message that it has to do with permissions to access de port, but no idea where else to look, since a driver problem seems not to be the issue (Arduino IDE can upload the code).
Any suggestion?

I’ve dealed with that problem. I initialized the new program for arduino nano. Then in platformio.ini changed [env: ] parametr to nanoatmega328new. I don’t now why it doesn’t changed automaticly. Thanks for help.

image

I got same error when i was working with Serial monitor and didn’t closed it before uploading. Maybe it is?

Hi. It’s a possibility I have checked, even though I don’t use de serial monitor because my project has its own CLI implemented through another physical serial port I connect on my hardware.

The step i made was identifìng that the error code 31 in Windows device administrator is related with its incapacity to find a driver. Weird, becuase it worked for more than a year.
Still seraching for the solution.

Well, I’m still trying to fix my workflow without success so far.

However, I discovered something interesting. While uploading with the Arduino IDE is possible, I realized that depending on the project I load to the Portenta, PlatformIO may or may not be able to upload new firmware.

I noticed that if the loaded project uses an instance of “Serial” (typically for a serial monitor), a COM port becomes visible in the Windows Device Manager during the Portenta’s “run mode.” In that case, I can upload using PlatformIO, even without switching the Portenta to “bootloader mode” (reset with a double-click).

On the other hand, if my project doesn’t instantiate a Serial over USB, no COM port is visible in “run mode” from the Windows Device Manager (though one does appear in “bootloader mode”). In this scenario, PlatformIO is unable to access the port, showing the yellow message I mentioned.

What puzzles me is that just a few weeks ago—and for over a year before that—the behavior described in the last paragraph was normal for me. PlatformIO could upload after setting the Portenta to “bootloader mode.” That was my workflow—the one I lost last week.

Has something changed in Windows or VSCode over the past few weeks? That’s what I’m trying to identify.