C:\Users\JAF>"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp flash:w:
avrdude: can't open config file "": Invalid argument
avrdude: error reading system wide configuration file ""
There you go. I wish I had known how to do that before....
Most likely, this will work:
"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp flash:w: -C "C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/etc"
If it gives the same error, then try:
Search your computer for avrdude.conf
. Then, press "Copy Path" in Windows Explorer. Then, run this command:
"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp flash:w: -C PASTE HERE
Of course, replacing PASTE HERE with pasting your clipboard. Leave the quotes. It's usually in Arduino Home\hardware\tools\avr\etc
, but it can vary.
Thanks for the reply.
Here is the result of the first:
C:\WINDOWS\system32>
C:\WINDOWS\system32>"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp flash:w: -C "C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/etc"
avrdude: can't open config file "C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/etc": Permission denied
avrdude: error reading system wide configuration file "C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/etc"
And here is the result of the second:
C:\WINDOWS\system32>"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp flash:w: -C "C:\Program Files (x86)\arduino-1.0.3\hardware\tools\avr\etc"
avrdude: can't open config file "C:\Program Files (x86)\arduino-1.0.3\hardware\tools\avr\etc": Permission denied
avrdude: error reading system wide configuration file "C:\Program Files (x86)\arduino-1.0.3\hardware\tools\avr\etc"
I hope this means more to you than it does to me....
The "Permission denied" means that the account you are running avrdude under doesn't have permission to read open that file. Maybe you need to copy the file to your account and then point to the new location. I'm not sure. In my experience, avrdude when run by the Arduino IDE always complains that the config file the IDE specifies doesn't exit.
Try this.
copy "C:\Program Files (x86)\arduino-1.0.3\hardware\tools\avr\etc" %USERPROFILE%\avrdude
"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp flash:w: -C %USERPROFILE%\avrdude
Aha this seems to have worked.......
C:\WINDOWS\system32>
C:\WINDOWS\system32>copy "C:\Program Files (x86)\arduino-1.0.3\hardware\tools\avr\etc" %USERPROFILE%\avrdude
C:\Program Files (x86)\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf
1 file(s) copied.
C:\WINDOWS\system32>"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp flash:w: -C %USERPROFILE%\avrdude
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9489
avrdude: current erase-rewrite cycle count is -218 (if being tracked)
avrdude: safemode: Fuses OK
avrdude done. Thank you.
C:\WINDOWS\system32>
Thank you so much for your help. I assume now I just put the Arduino into DFU mode as per the instructions, and then carry on as normal?
Hmmm. Strangely the board still will not go into DFU mode. I short both sets of connections but it only seems to reset, not entering DFU mode. Has the process above not worked?
I joined pretty late. Reading back, you'll need to merge these two commands. Check the steps here and merge that command with the one you have.
Thanks for this. Would it be possible to give an example as I am completely new to this and unsure what to merge with what and which bits to keep etc...
Maybe
"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp -F -U flash:w:"C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares/MEGA-dfu_and_usbserial_combined.hex" -C %USERPROFILE%\avrdude
Thanks for the suggestion, here is the result:
C:\WINDOWS\system32>
C:\WINDOWS\system32>"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp -F -U flash:w:"C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares/MEGA-dfu_and_usbserial_combined.hex" -C %USERPROFILE%\avrdude
avrdude: invalid file format '/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares/MEGA-dfu_and_usbserial_combined.hex' in update specifier
avrdude: error parsing update operation 'flash:w:C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares/MEGA-dfu_and_usbserial_combined.hex'
Maybe?
cd "C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares"
"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp -F -U flash:w:MEGA-dfu_and_usbserial_combined.hex -C %USERPROFILE%\avrdude
Also, when replying, PLEASE use code tags. See forum.arduino.cc/index.php?topic=148850.0, number 7.
Thanks for that, here is the result:
C:\WINDOWS\system32>cd "C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares"
C:\Program Files (x86)\arduino-1.0.3\hardware\arduino\firmwares>"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp -F -U flash:w:MEGA-dfu_and_usbserial_combined.hex -C %USERPROFILE%\avrdude
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9489
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: current erase-rewrite cycle count is -218 (if being tracked)
avrdude: erasing chip
avrdude: reading input file "MEGA-dfu_and_usbserial_combined.hex"
avrdude: error opening MEGA-dfu_and_usbserial_combined.hex: No such file or directory
avrdude: input file MEGA-dfu_and_usbserial_combined.hex auto detected as invalid format
avrdude: can't open input file MEGA-dfu_and_usbserial_combined.hex: No such file or directory
avrdude: read from file 'MEGA-dfu_and_usbserial_combined.hex' failed
avrdude: safemode: Fuses OK
avrdude done. Thank you.
C:\Program Files (x86)\arduino-1.0.3\hardware\arduino\firmwares>
Once again, sorry for my incompetence....
-U flash:w:"C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares/MEGA-dfu_and_usbserial_combined.hex"
Put ':i' after the '.hex' to tell avrdude that the file is in Intel Hex format.
Alright. This will probably work. I keep on forgetting that you need to copy things before telling avrdude to read them.
cd "C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares"
dir
copy MEGA-dfu_and_usbserial_combined.hex %USERPROFILE%\MEGA-dfu_and_usbserial_combined.hex
cd %USERPROFILE%
"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp -F -U flash:w:MEGA-dfu_and_usbserial_combined.hex:i -C %USERPROFILE%\avrdude
Thanks for the replies. Sorry for the long wait; I have been away.
Here is the result of the above post:
C:\WINDOWS\system32>cd "C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/firmwares"
C:\Program Files (x86)\arduino-1.0.3\hardware\arduino\firmwares>dir
Volume in drive C is Acer
Volume Serial Number is 04EF-79E7
Directory of C:\Program Files (x86)\arduino-1.0.3\hardware\arduino\firmwares
11/05/2016 17:34 <DIR> .
11/05/2016 17:34 <DIR> ..
11/05/2016 17:34 <DIR> atmegaxxu2
11/05/2016 17:34 <DIR> wifishield
0 File(s) 0 bytes
4 Dir(s) 292,736,901,120 bytes free
C:\Program Files (x86)\arduino-1.0.3\hardware\arduino\firmwares>copy MEGA-dfu_and_usbserial_combined.hex %USERPROFILE%\MEGA-dfu_and_usbserial_combined.hex
The system cannot find the file specified.
C:\Program Files (x86)\arduino-1.0.3\hardware\arduino\firmwares>cd %USERPROFILE%
C:\Users\JAF>"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp -F -U flash:w:MEGA-dfu_and_usbserial_combined.hex:i -C %USERPROFILE%\avrdude
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9489
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "MEGA-dfu_and_usbserial_combined.hex"
avrdude: can't open input file MEGA-dfu_and_usbserial_combined.hex: No such file or directory
avrdude: read from file 'MEGA-dfu_and_usbserial_combined.hex' failed
avrdude: safemode: Fuses OK
avrdude done. Thank you.
You're on Arduino 1.0.3 - the current version is 1.6.9. As you can see, there's a big difference. It's not critical, but there are some major changes. I'd recommend downloading the new version from arduino.cc/download_handler.php?f=/arduino-1.6.9-windows.exe and install it. Then, run
cd "C:/Program Files (x86)/arduino-1.6.9/hardware/arduino/avr/firmwares/atmegaxxu2"
dir
copy MEGA-dfu_and_usbserial_combined.hex %USERPROFILE%\MEGA-dfu_and_usbserial_combined.hex
cd %USERPROFILE%
"C:/Program Files (x86)/arduino-1.6.9/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp -F -U flash:w:MEGA-dfu_and_usbserial_combined.hex:i -C %USERPROFILE%\avrdude
Alternatively, if you've decided not to update, you can run
[code]cd "C:/Program Files (x86)/arduino-1.0.3/hardware/arduino/avr/firmwares/atmegaxxu2"
dir
copy MEGA-dfu_and_usbserial_combined.hex %USERPROFILE%\MEGA-dfu_and_usbserial_combined.hex
cd %USERPROFILE%
"C:/Program Files (x86)/arduino-1.0.3/hardware/tools/avr/bin/avrdude" -P usb -p m16u2 -b 1200 -c usbasp -F -U flash:w:MEGA-dfu_and_usbserial_combined.hex:i -C %USERPROFILE%\avrdude
[/code]
Here is what happened when I tried to paste the first in, having installed 1.6.9:
C:\WINDOWS\system32>cd "C:/Program Files (x86)/arduino-1.6.9/hardware/arduino/avr/firmwares/atmegaxxu2"
C:\Program Files (x86)\arduino-1.6.9\hardware\arduino\avr\firmwares\atmegaxxu2>dir
Volume in drive C is Acer
Volume Serial Number is 04EF-79E7
Directory of C:\Program Files (x86)\arduino-1.6.9\hardware\arduino\avr\firmwares\atmegaxxu2
14/06/2016 22:08 <DIR> .
14/06/2016 22:08 <DIR> ..
10/05/2016 10:18 20,907 Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex
10/05/2016 10:18 20,907 Arduino-COMBINED-dfu-usbserial-atmega16u2-MegaADK-Rev3.hex
10/05/2016 10:18 20,907 Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex
14/06/2016 22:08 <DIR> arduino-usbdfu
14/06/2016 22:08 <DIR> arduino-usbserial
10/05/2016 10:18 37,168 Genuino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-R3.hex
10/05/2016 10:18 37,168 Genuino-COMBINED-dfu-usbserial-atmega16u2-Uno-R3.hex
10/05/2016 10:18 17,712 MEGA-dfu_and_usbserial_combined.hex
10/05/2016 10:18 1,800 README.txt
10/05/2016 10:18 17,688 UNO-dfu_and_usbserial_combined.hex
8 File(s) 174,257 bytes
4 Dir(s) 292,993,028,096 bytes free
C:\Program Files (x86)\arduino-1.6.9\hardware\arduino\avr\firmwares\atmegaxxu2>copy MEGA-dfu_and_usbserial_combined.hex %USERPROFILE%\MEGA-dfu_and_usbserial_combined.hex
Overwrite C:\Users\JAF\MEGA-dfu_and_usbserial_combined.hex? (Yes/No/All): Yes
1 file(s) copied.
C:\Program Files (x86)\arduino-1.6.9\hardware\arduino\avr\firmwares\atmegaxxu2>