Hello,
I have a few Arduinos, UNO/Nano/Mini/Mega, and a few PCs and up until now everything loads fine. Today the IDE failed to load the program into a Nano. That project had been loaded into that Nano many times before. I've tried lots of things:
- new project - blink - same, won't load.
- another Nano - same, won't load.
- another PC - good, can load, both Nanos.
- use Putty on the com port - good println output (from program loaded with other pc).
- re-install Arduino software 1.8.7 -> 1.8.8 - no help, same problem.
Then I looked at the error messages:
Using Port : COM17
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x60
(sometimes it was resp=0x00)
and I thought that was the wrong baud rate, so tried using a command file to load, at 57600 - Success!
@rem Arduino build from command line.
@rem https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc
@rem Put this file in the Arduino project folder (with MyProg.ino)
@rem Arduino Type =====================================
@rem
@rem Uno
@rem Set brd=arduino:avr:uno
@rem
@rem Mega
@rem brd=arduino:avr:mega:cpu=atmega2560
@rem
@rem Nano
Set brd=arduino:avr:nano:cpu=atmega328
@rem
@rem Arduino pro mini
@rem set brd=arduino:avr:pro:cpu=16MHzatmega328
@rem
@rem
rem Arduino software executable =======================
set cmd=C:\Programs\Arduino\arduino.exe
set cmd=C:\Programs\Arduino\arduino_debug.exe
@rem arduino.exe - GUI, output to stdout, stderr
@rem arduino_debug.exe - output to console
@rem Project folder (and file name) ===================
for /F "delims=\" %%A in ("%0%") do (
set src=%%~nxA
)
@rem Source path and filename
set afl=C:%~sp0%src%.ino
echo %afl%
@rem Board Type =======================================
@rem Nano
set brd=arduino:avr:nano:cpu=atmega328
@rem Uno
@rem set brd=arduino:avr:uno
@rem Mega
@rem set brd=arduino:avr:mega:cpu=atmega2560
rem COM port =========================================
set prt=COM17
rem ==================================================
set bdd=atmega328p
set baud=57600
@rem Temporary files
set tmp=%temp%\Arduino\%src%
if not exist %tmp% mkdir %tmp%
%cmd% --board %brd% --port %prt% --preserve-temp-files --verify --pref build.path=%tmp% %afl%
@rem arduino --pref build.path=/path/to/sketch/build --verify /path/to/sketch/sketch.ino
@rem used to work with --upload, but now using separate command
set avd=C:\Programs\Arduino\hardware\tools\avr\bin\avrdude
set avc=C:\Programs\Arduino\hardware\tools\avr\etc\avrdude.conf
%avd% -C%avc% -q -p%bdd% -carduino -P%prt% -b%baud% -D -Uflash:w:%tmp%\%src%.ino.hex:i
@rem -v or -q for verbose or quiet
pause
There's a comment in there that the single build+upload command used to work, but now I'm using a separate command, probably the same issue.
- in the IDE change the board type to Pro Mini - success! uses 57600 baud.
Using Port : COM17
Using Programmer : arduino
Overriding Baud Rate : 57600
So it looks like the IDE is confused on what's the correct baud rate for a Nano.