Ok. So, I am trying to recover an Uno that I screwed up and I'm not having much luck. I flashed GRBL (.hex - via XLoader) to it a while ago, which I'm guessing overwrote the bootloader. I have another Uno that I can use for ArduinoISP (or Gammon's bootloader programmer), but I haven't been able to flash the bootloader. I'm thinking that GRBL is starting up and blocking attempts to flash the bootloader. I feel like if I could maybe stop/delay GRBL from loading, I might be able to flash the bootloader. I am honestly out of ideas at this point. Any help/ideas/suggestions you can provide would be greatly appreciated!
Please do this:
- Set up the Arduino as ISP configuration following this: https://www.arduino.cc/en/Tutorial/ArduinoISP
- File > Preferences > Show verbose output during: > compilation (uncheck) > upload (check) > OK
- Tools > Burn Bootloader
- After the upload fails you'll see a button on the right side of the orange bar "Copy error messages". Click that button.
- Paste the error messages in a reply here USING CODE TAGS (</> button on the toolbar).
Arduino: 1.8.5 (Windows 8.1), Board: "Arduino/Genuino Uno"
C:\Users\Joseph\Desktop\arduino-1.8.5\hardware\tools\avr/bin/avrdude -CC:\Users\Joseph\Desktop\arduino-1.8.5\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM3 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\Joseph\Desktop\arduino-1.8.5\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
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 : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
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.02s
avrdude: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)
Error while burning bootloader.
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0xffffff (probably .reduced_core_tiny)
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
If I add the -F flag, I get the following:
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\Joseph\Desktop\arduino-1.8.
5\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
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 Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 36
00 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 45
00 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 45
00 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 : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
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.02s
avrdude: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0xffffff (probably .reduced_core_tiny)
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATmega328P is 1E 95 0F
avrdude: safemode: hfuse reads as FF
avrdude: safemode: efuse reads as FF
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% -0.00s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% -0.00s
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):
Writing | | 0% 0.00s ***faile
d;
Writing | ################################################## | 100% 0.11s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0xff != 0xfd
avrdude: verification error; content mismatch
avrdude: safemode: hfuse reads as FF
avrdude: safemode: efuse reads as FF
avrdude: safemode: efuse changed! Was fd, and is now ff
Would you like this fuse to be changed back? [y/n]
If I select yes, it hangs and does nothing.
If I select no, it finishes and GRBL is still running.
I just double-checked the wiring. It's correct. I even swapped out the wires to make sure that wasn't an issue. I've tried a number of different wiring configurations as well (using ISCP headers, ISCP headers with pin 5 to D10, the configuration that you just sent, etc.).
It's worth mentioning that I can't get it to take any .hex file. I tried simply overwriting the GRBL hex with the bootloader via XLoader, but it fails. GRBL immediately starts listening for commands on startup, so I'm guessing it's interfering with things because of that.
Any further ideas/help you guys have to offer is greatly appreciated!
Try holding down the reset button on the Uno you are programming until you see:
avrdude: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/kprims/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/etc/avrdude.conf"
User configuration file is "/home/kprims/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyUSB0
Using Programmer : stk500v1
Overriding Baud Rate : 19200
Release the button Just when this shows up.
It might allow you to get a little further.
No such luck. That's something that I tried earlier as well. Just tried it again, and I still get the same. I had read something about needing a 10uf capacitor to disable the auto-reset mechanism, but I'm not sure if this applies to the Uno. Most guides that I've seen don't include it. I have a feeling that if I could keep GRBL from starting I wouldn't have any issues, but I have no idea how to do that (or if it is even possible).
I just tried changing the SPI leads in the Arduino as ISP sketch. Just the SCK lead from 13 to 4 as a small test. It worked OK. You could try a few different PINs and see if you could sneak an erase of the chip
// Uncomment following line to use the old Uno style wiring
// (using pin 11, 12 and 13 instead of the SPI header) on Leonardo, Due..
#define USE_OLD_STYLE_WIRING
#ifdef USE_OLD_STYLE_WIRING
#define PIN_MOSI 11
#define PIN_MISO 12
#define PIN_SCK 4
#endif
I played around with the pins for a while like you suggested and didn't get anywhere. It got me curious about which pins GRBL is using. As it turns out... basically all of them.
If you look here, you'll see that essentially every pin is monitored by GRBL. After reading the documentation, I noticed that I might be able to force GRBL into "Alarm" mode, which prevents it from processing any commands, by using the limit switch pins. I happen to have a limit switch lying around, so I'll try it out tomorrow. Maybe if I force GRBL into alarm mode I'll be able to bypass it and burn the bootloader. I will update at some point tomorrow.
Thanks for your help thus far!
I played around with the pins for a while like you suggested and didn't get anywhere. It got me curious about which pins GRBL is using. As it turns out... basically all of them.
I woke up in the middle of the night and realized I was changing pins on the wrong Uno. Sorry.