AT89S52在Linux下的燒錄方法
http://hi.baidu.com/%B5%FB%CF%FE%C3%CE/blog/item/1aa1050958898c2e6a60fbd0.html
蝶曉夢(vowstar(#)gmail.com)
今天終于琢磨出來怎么在linux下燒錄AT89s52.
下面是我的方法...當(dāng)然可能有更好的方法.
這里以Ubuntu為例子,先安裝avrdude.
用下面的命令一次裝全吧:
sudo apt-get install gcc-avr binutils-avr avrdude avr-libc
然后編輯avrdude.conf:
sudo gedit /etc/avrdude.conf
在最后面加入AT89s52的相關(guān)信息(這是Joy Shukla寫的)
#------------------------------------------------------------
# Below chips by added by me .. Joy Shukla(joy_shukla@yahoo.in)
# these chips can be programmed with my usbasp programmer(changed atmega8 program)
# after adding avrdude support in this file ..
#------------------------------------------------------------
#------------------------------------------------------------
# AT89S52
#------------------------------------------------------------
part
id = "8052";
desc = "AT89S52";
signature = 0x1E 0x52 0x06;
chip_erase_delay = 20000;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
"x x x x x x x x x x x x x x x x";
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
"x x x x x x x x x x x x x x x x";
timeout = 200;
stabdelay = 100;
cmdexedelay = 25;
synchloops = 32;
bytedelay = 0;
pollindex = 3;
pollvalue = 0x53;
predelay = 1;
postdelay = 1;
pollmethod = 0;
memory "flash"
size = 8192;
paged = no;
min_write_delay = 4000;
max_write_delay = 9000;
readback_p1 = 0xff;
readback_p2 = 0xff;
read = " 0 0 1 0 0 0 0 0",
" x x x a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
write = " 0 1 0 0 0 0 0 0",
" x x x a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
mode = 0x21;
delay = 12;
;
memory "signature"
size = 3;
read = "0 0 1 0 1 0 0 0 x x x 0 0 0 a1 a0",
"0 0 0 0 0 0 0 0 o o o o o o o o";
;
;
#------------------------------------------------------------
然后保存
現(xiàn)在就可以燒錄AT89S52的單片機了,
例如我想燒錄放在桌面上的編譯好的跑馬燈程序,
用命令
sudo avrdude -p 8052 -c usbasp -e -U flash:w:/home/vowstar/桌面/跑馬燈.hex
即可
效果如圖:
開發(fā)板上的效果:
注意事項:
如果提示器件沒有響應(yīng),signature = 0x000000原因是:usbasp的固件不能用原裝的 (http://www.fischl.de/usbasp/)
要用來自這里的http://www.8051projects.info/blogs/usb-8051-avr-programmer.html
2. 提示:~/Desktop $ sudo avrdude -p 8052 -c usbasp -e
avrdude: Cant find programmer id "usbasp"
Valid programmers are:
上面這種情況接 usbasp編程器(并口的)到電腦上,然后在終端下執(zhí)行命令lsusb,提示:
~/Desktop $ lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 16c0:05dc VOTI USBasp AVR Programmer
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 04fc:05da Sunplus Technology Co., Ltd
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 0ac8:0321 Z-Star Microelectronics Corp. Vimicro generic vc0321 Camera
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
這樣看來,編程器沒問題可以被識別.
檢查一下/etc/avrdude.conf中是不是上文所述配置,然后檢查編程器的跳線設(shè)置,跳線帽錯沒,再檢查一下單片機是不是AT89S52,
最后確認單片機外圍不能接其他影響IO傳輸?shù)钠骷?比如DS18B20,ULN2003等,斷開它們?nèi)缓髧L試下載.
下載程序時要用root權(quán)限
評論