Hello! So I was using my Arduino Mega 2560 as an ISP and successfully flashing my code onto my AT328PU chip and then I dropped my breadboards
and my Arduino stopped working as an ISP. I re-assembled my project and probably foolishly, I re-uploaded the Arduino as ISP sketch where SCK is 52, MISO 50, and MOSI 51 and this worked. However when I went to flash to AT328 it no longer worked. I tried re-burning the bootloader but haven’t been able to do this.
Here is my setup right now (same as previously):
AT328 pin 1 → Mega2560 RESET
AT328 pin 7, 8 — .1uF cap across — pin 7 to +5V, pin 8 to GND
AT328 pin 20, 22 — .1uF cap across — pin 20 +5V, pin 22 to GND
AT328 pin 9, 10 — 16MHz crystal across — pin 9 to 22pF to GND, pin 10 to 22pF to GND
AT328 pin 17 — Mega2560 pin 51
AT328 pin 18 — Mega2560 pin 50
AT328 pin 19 — Mega2560 pin 52
Mega2560 pin 10 to 10uF cap to GND
Mega2560 pin 9 to resistor to LED (track ISP is running via heartbeat)
All +5V and GNDs are rails common to Mega2560 GND and +5V outputs
This is exact set up I had before. I see the LED heartbeat flashing indicating that MEga2560 is running ISP script.
Then I try to flash a script I get this output (note that the first part of the output is just from my personal bat script that I use for flashing. It was working previously so not the culprit of the problem):
Cleaning preivous build...
rm -f piezo-0.elf piezo-0.hex
Building Project...
avr-gcc -mmcu=atmega328p -DF_CPU=16000000UL -Os -o piezo-0.elf piezo-0.c
avr-objcopy -O ihex -R .eeprom piezo-0.elf piezo-0.hex
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\jcbls\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17\etc\avrdude.conf"
Using Port : COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
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.09s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x020000
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.
avrdude done. Thank you.
Done!
Press any key to continue . . .
Here is the output when I try to upload a new bootloader (Tools→board–>Uno, Programmer → Arduino as ISP):
"C:\Users\jcbls\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\jcbls\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/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-20190619Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\jcbls\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
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 = 0x000000 (retrying)
Reading | ################################################## | 100% 0.03s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.Double check connections and try again, or use -F to overridethis check.
avrdude done. Thank you.
Failed chip erase: uploading error: exit status 1
What should I be doing to re-establish the connection betwen mega2560 and at328? Again the at328 has been in use it is not fresh!!! so I imagine the steps are a bit different?
Thank you for your help in advance!