Hello,
Do you also hate the feeling when something went wrong, but you don't know what exactly happened? Here's the short story:
I uploaded the standard Blink.ino sketch on an ATMega328P using a breadboard and Arduino as ISP in Arduino IDE.
The led blinked very slowly, so I figured the chip was running on the factory clock setting of 8Mhz/8 = 1MHz. After that I tried uploading the bootloader. The process failed. Since then I can no longer communicate to the chip. (Yikes, invalid signature, check connections...)
Can anyone tell me if I did something wrong?
Also, the chip was given to me sitting on an old Arduino NG board, which doesn't use the 328P (as far as I know), that's why i tried it on a breadboard. Could the chip be damaged and did I just get lucky uploading the one program?
I'm clueless and I hate it ![]()
UPDATE
The board is a VMA101 Atmega2560 mega development board.
Connections (328P --> 2560):
white - RESET (1) --> PIN 10
red - Vcc (7) --> Vcc on ICSP
black - GND (8) --> GND on ICSP
yellow - SCK (19) --> SCK on ICSP
brown - MISO (18) --> MISO on ICSP
green - MOSI (17) --> MOSI on ICSP
the ceramic cap is 100n (Vcc to GND)
the electrolytic cap is 4.7u (RESET to GND)
Arduino IDE v1.8.19 on linux with following settings:
Board: "Arduino Duemilanove or Diecimila"
Processor: "ATmega328P"
Port: "/dev/ttyACM0 (Arduino Mega or Mega 2560)"
Programmer: "Arduino as ISP"
When I "upload using programmer", avrdude says:
Arduino: 1.8.19 (Linux), Board:"Arduino Duemilanove or Diecimila, ATmega328P"
De schets gebruikt 924 bytes (3%) programma-opslagruimte. Maximum is 30720 bytes.
Globale variabelen gebruiken 9 bytes (0%) van het dynamisch geheugen. Resteren 2039 bytes voor lokale variabelen. Maximum is 2048 bytes.
/home/user/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/home/user/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyACM0 -b19200 -Uflash:w:/tmp/arduino_build_775667/Blink.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 "/home/user/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/home/user/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyACM0
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.02s
avrdude: Device signature = 0x000000 (retrying)
Er is een fout opgetreden bij het uploaden van de schets
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
Dit rapport zou meer informatie bevatten met
"Uitgebreide uitvoer weergeven tijden compilatie"
optie aan in Bestand -> Voorkeuren.
I also just ran this command in terminal (please, don't ask why
):
UPDATE2 (ran this again with Vcc disconnected from the chip and got identical output, so probably rubbish)
avrdude -v -F -V -c stk500v1 -p m328p -P /dev/ttyACM0 -b 19200 -U flash:r:flash_backup.hex:i
avrdude says:
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 "/etc/avrdude.conf"
User configuration file is "/home/user/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyACM0
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.02s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATmega328P is 1E 95 0F
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading flash memory:
Reading | ################################################## | 100% 20.47s
avrdude: writing output file "flash_backup.hex"
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
This does output a hexfile, containing mostly 0's.
1 :200000000000000000000000000000000000000000000000000000000000000000000000E0
2 :200020000000000000000000000000000000000000000000000000000000000000000000C0
3 :200040000000000000000000000000000000000000000000000000000000000000000000A0
3 :20006000000000000000000000000000000000000000000000000000000000000000000080
4 :20008000000000000000000000000000000000000000000000000000000000000000000060
...
1022 :207FA0000000000000000000000000000000000000000000000000000000000000000000C1
1023 :207FC0000000000000000000000000000000000000000000000000000000000000000000A1
1024 :207FE000000000000000000000000000000000000000000000000000000000000000000081
1025 :00000001FF
Did I successfully read the flash or did I just get rubbish?



