Noyito CP2102 to program Arduino Pro Mini, programmer set up?

I picked up a set of these USB to TTL modules, as they were recommended for the Pro Mini’s, and the examples I see are all using the Arduino IDE, not VSCode with PlatformIO.

The Drivers under my workstation set up COM7 for the Silicon Labs USB driver, but I am not sure what upload protocol to try. One article I found here said stlink, but that is not in the list of valid programmers.

Link for USB/TTL CP2012 module I have:
https://www.amazon.com/NOYITO-CP2102-Converter-Downloader-Arduino/dp/B07D54K82D

If I use the ArduinoIDE with the USBasp as my programmer it works.

Tried that as my Upload_Protocol, and it is looking for a particular vendor ID?

Configuring upload protocol…
AVAILABLE: USBasp
CURRENT: upload_protocol = USBasp
Looking for upload port…
Using manually specified: COM7
Uploading .pio\build\uno\firmware.hex
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor=‘www.fischl.de’ product=‘USBasp’

Why would this be an USBasp? It’s just a regular USB-to-serial adapter. The default upload_protocol = arduino should suffice perfectly.

Are you sure about this? Are you clicking the regular upload button or “Upload via Programmer” in the menu? Because only in the latter does it really upload via the selected programmer, it’s ignored otherwise.

I am just hitting the arrow to send the code… but I was following the demo from YouTube using this CP2102 USB to TTL example. He had me select USBasp as the programmer.

When I allow PIO to select Arduino on it’s own, it times out finding a programmer after 10 attempts.

Mine being: VID_10C4&PID_EA60
USBasp looking for:
Uploading .pio\build\uno\firmware.hex
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor=‘www.fischl.de’ product=‘USBasp’

Okay, very easy path to the solution: In your Arduino IDE where the upload supposedly works, go to File → Preferences ->Tick “Verbose Upload”. Hit upload again. Post the entire log that the Arduino IDE prints.

If the upload is successful, the right settings are right in there and can be transported to PlatformIO.

1 Like

OK, here we go. Just sent blink when I got up.

Looks as if you had it all along, the IDE used “Arduino” cause I did NOT say use programmer.

So, with VSCode using PIO, this still should work, yes? There a debug I can run there to see why it times out?

Sketch uses 444 bytes (1%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
“C:\Users\nicko\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude” “-CC:\Users\nicko\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf” -v -V -patmega328p -carduino “-PCOM7” -b57600 -D “-Uflash:w:C:\Users\nicko\AppData\Local\Temp\arduino\sketches\1193436E429A5CEFF9D04E9992EA424B/sketch_oct26a.ino.hex:i”

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Users\nicko\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

     Using Port                    : COM7
     Using Programmer              : arduino
     Overriding Baud Rate          : 57600
     AVR Part                      : ATmega328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : Arduino
     Description     : Arduino
     Hardware Version: 2
     Firmware Version: 1.16
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file “C:\Users\nicko\AppData\Local\Temp\arduino\sketches\1193436E429A5CEFF9D04E9992EA424B/sketch_oct26a.ino.hex”
avrdude: writing flash (444 bytes):

Writing | ################################################## | 100% 0.14s

avrdude: 444 bytes of flash written

avrdude done. Thank you.

OK, you gave me an idea. I added

upload_flags = --verbose

Thinking that would work, but it was the wrong syntax yet the programmer SENT the code. (facepalm)

OK, glitch… fixed the flag to

upload_flags= -f

now it fails, but tells me WHY.

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega168 is 1E 94 06
         Double check chip, or use -F to override this check.

I appear to have some odd knock off Pro Mini 16Mhz 5v boards? Meh, ok, added -F to the options.

Board programs just fine now. THANK YOU for giving me the tools on how to see what is going on under the hood, I did not know what to look for.

(If any of that needs more testing, let me know, I am happy to run more tests)

These are the important settings. And these are already default for the right board definitions.

Did you try something like

[env:pro16MHzatmega328]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino

Because this will inherit the right settings without you having to specify upload_speed, upload_protocol etc.

Oh you’re treating your Arduino Pro Mini as an Uno? Well the Uno has a 115200 programmer baud, not the 57600 baud the Pro Mini has, so that’s the actual source of the program.

Of course you could do

[env:uno]
platform = atmelavr
board = uno
framework = arduino
upload_speed = 57600

but really, you should be using the right board definition upfront to avoid any errors.

1 Like

OMG, I feel dumb… I just typed in the search list Pro Mini and grabbed the first one that matched my speed and voltage, never saw that there were others…

No idea how in the dark I was, the Arduino IDE just went as far as Pro Mini and the MHz/Voltage…

Thank you

Started brand new project, this is all that is in my .ini

[env:env1]
board = pro16MHzatmega328
platform = atmelavr
framework = arduino

Works first try… now I am dangerous :smiley:

1 Like

Just for reference: If in doubt about which board to use (if multiple apply), you can look at all available ones in the platform or in the registry.