AVR ISP + Atmega16
Есть микроконтроллер Atmega16L-8PU, который я пытаюсь прошить с помощью Arduino Mega 2560, используя скетч ArduinoISP и avrdude.
- Создал тестовый проект в Atmel Studio, скомпилировал под Atmega16.
- Прошил Arduino скетчем ArduinoISP
- Подключил второй микроконтроллер, также установил конденсатор 10мкФ между Reset и GND Ардуино (без него ошибка "out of sync")
- Запускаю avrdude:
avrdude -v -p m16 -c avrisp -P COM3 -b 19200 -D -U flash:w:".\hex\test.hex":i
avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
System wide configuration file is "C:\Users\Public\avr\avrdude.conf"
Using Port : COM3
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA16
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
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 4 10 128 0 no 512 4 0 9000 9000 0xff 0xff
flash 33 6 128 0 yes 16384 128 128 4500 4500 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
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
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
Видно, что сигнатура устройства неверная (0x000000).
В скетче ArduinoISP сделал #define SPI_CLOCK (128000/6).
Если в avrdude установить флаг -F, то запись как будто бы идет, но проверка в итоге не проходит:
avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
System wide configuration file is "C:\Users\Public\avr\avrdude.conf"
Using Port : COM3
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA16
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
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 4 10 128 0 no 512 4 0 9000 9000 0xff 0xff
flash 33 6 128 0 yes 16384 128 128 4500 4500 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
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
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATMEGA16 is 1E 94 03
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: reading input file ".\hex\test.hex"
avrdude: writing flash (150 bytes):
Writing | ################################################## | 100% 0.48s
avrdude: 150 bytes of flash written
avrdude: verifying flash memory against .\hex\test.hex:
avrdude: load data flash data from input file .\hex\test.hex:
avrdude: input file .\hex\test.hex contains 150 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.34s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0x00
avrdude: verification error; content mismatch
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: Fuses OK
avrdude done. Thank you.
P.S. Atmega16 новая.
Ответы (1 шт):
Автор решения: Аркадий
→ Ссылка
Проблема была в качестве подключения: изначально собирал на макетной плате. В итоге спаял надстройку с нормальными соединениями и все заработало.