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.
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.
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
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)
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.
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…