Linux下,使用avrdude下载程序到ATmega16,能正常连上,但是下载出错
本帖最后由 jdpshq 于 2012-08-23 20:31:50 编辑 用part来修改eeprom这还可以,但是用来下载hex文件到板上就不行了,都在最后一个read的时候出现:
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0x00
avrdude: verification error; content mismatch
然后,板子完全没有了反映,reset也不管用,就像是hex完全没有进去一样,但是用windows xp就可以写入,也就是板子本身应该是没有问题的。
具体代码是这样的:
下面这个是用avrdude擦写eeprom,貌似是成功的:
[root@Jd ]# avrdude -p m16 -c usbasp -t
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9403
avrdude> part
>>> part
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
avrdude> dump eeprom 0 16
>>> dump eeprom 0 16
0000 ff 02 03 04 ff ff e0 ff ff ff ff ff ff 92 ff ff |................|
avrdude> write eeprom 0 1 2 3 4 5 6
>>> write eeprom 0 1 2 3 4 5 6
avrdude> dump eeprom 0 16
>>> dump eeprom 0 16
0000 01 02 03 04 05 06 e0 ff ff ff ff ff ff 92 ff ff |................|
avrdude> erase
>>> erase
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude> dump eeprom 0 16
>>> dump eeprom 0 16
0000 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 |................|
avrdude> quit
>>> quit
avrdude: safemode: lfuse changed! Was e1, and is now fe
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: hfuse changed! Was d9, and is now 0
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK
avrdude done. Thank you.
[root@Jd êy??1ü]# avrdude -p m16 -c usbasp -e -U flash:w:DIS_CON.hex
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9403
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "DIS_CON.hex"
avrdude: input file DIS_CON.hex auto detected as Intel Hex
avrdude: writing flash (1472 bytes):
Writing | ################################################## | 100% 0.75s
avrdude: 1472 bytes of flash written
avrdude: verifying flash memory against DIS_CON.hex:
avrdude: load data flash data from input file DIS_CON.hex:
avrdude: input file DIS_CON.hex auto detected as Intel Hex
avrdude: input file DIS_CON.hex contains 1472 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.42s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0x00
avrdude: verification error; content mismatch
avrdude: safemode: lfuse changed! Was e1, and is now 0
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: hfuse changed! Was d9, and is now 0
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK
avrdude done. Thank you.
avrdude: safemode: hfuse changed! Was d9, and is now 0
Would you like this fuse to be changed back? [y/n] n
最奇怪就是这里,最后一个read,verifying的时候出错
[解决办法]
求助高手…………
[解决办法]
你的问题解决了吗?我也遇到了同样的问题了。
[解决办法]
正好你现在也在做这个,咱们能一起学习吗?我的qq号码是754533431