带PDI接口的USBasp
简介
这是一种基于ATMEL公司单片机的可向51系列、AVR系列单片机下载程序的下载器。增加SPI端口,配合USBASB-PDI固件及魔改过的avrdude,可替代昂贵设备实现PDI接口编程。
简介:这是一种基于ATMEL公司单片机的可向51系列、AVR系列单片机下载程序的下载器。增加SPI端口,配合USBASB-PDI固件及魔改过的avrdude,可替代昂贵设备实现PDI接口编程。开源协议
:Public Domain
描述
首先致歉:摘要里写错了,是带PDI接口的USBASP。
USBasp - USB programmer for Atmel AVR controllers
这是一种基于ATMEL公司单片机的,可向51系列、AVR系列单片机下载程序的下载器。
基本电路按参考官方版本(项目地址:http://www.fischl.de/usbasp/),增加PDI端口,配合USBASB-PDI固件及魔改过的avrdude,可替代昂贵设备实现PDI接口编程。
开源社区里已有几个大神发布过USBASP。我之所以要在做一版,主要原因是在做一个变色龙Mini(chameleonmini_reve_rebooted)的DIY时,需要一个方便使用的PDI接口编程器,因此有了此项目。
硬件上,本设计其实就是在USBASP原版设计基础上,新增一个跳线、PDI接口。
支持PDI的固件地址:github.com/nieldk/USBASP-PDI。
另外还需要配合一个魔改avrdude,该项目地址:github.com/nieldk/avrdude。
上述编译后固件及软件我会放在附件中。
这个USBASP需要另一个编程器对它进行固件刷入,有两种方法:
一、使用一个好的USBASP刷:
1、将要刷USBASP-PDI的USBASP的J2短接(SELF PROG),电压跳线设置为5V;
2、用第二个USBASP作为刷写线,将其输出电压设为5V;
3、将第二个USBASP插入电脑,使用Zadig安装USBASP驱动为“libusb-win32 (v1.2.6.0)”;
4、使用10Pin电缆连接两个USBASP;
5、使用AVRDUESS,通过第二个USBASP刷第一个USBASP
Programmer 设置为 USBASP
MCU设置为 ATmega8
选择Flash为已补丁过的USBASP-PDI固件
熔丝位设置 L 0xEF H 0xC9 E 0x00 LB 0xFF
或者直接使用命令行刷入:
avrdude -c usbasp -p m8 -U lfuse:w:0xEF:m -U hfuse:w:0xC9:m -U lock:w:0xFF:m
avrdude -c usbasp -p m8 -U flash:w:"D:\working\USBASP-PDI\main.hex":a
二、使用Arduion UNO刷写成的Arduion ISP刷:
1、将Arduino UNO开发板刷成ArduinoISP:选择打开ArduinoISP工程,编译上传到UNO,使UNO成为一个编程器。
2、使用这个ArduinoISP执行“烧录引导程序”操作:
3、硬件连接:
左边为UNO开发板上的插针序号,右边为USBASP的针序号,VCC接5V,GND互联,USBASP的JP1跳线跳到5V上、JP2短接。
(手绘图,见笑)
4、使用avrdude进行固件刷入:
avrdude -v -c stk500v1 -p m8 -c stk500v1 -P COM3 -b 19200 -e -U lock:w:0x00:m -U lfuse:w:0xEF:m -U hfuse:w:0xC9:m
avrdude -c stk500v1 -p m8 -P COM3 -b 19200 -U flash:w:"main.hex":a
执行情况:
D:\working\USBASP-PDI>avrdude -v -c stk500v1 -p m8 -c stk500v1 -P COM3 -b 19200 -e -U lock:w:0x00:m -U lfuse:w:0xEF:m -U hfuse:w:0xC9:m avrdude: Version 6.4 Copyright (c) Brian Dean, http://www.bdmicro.com/ Copyright (c) Joerg Wunsch System wide configuration file is "D:\working\USBASP-PDI\avrdude.conf" Using Port : COM3 Using Programmer : stk500v1 Overriding Baud Rate : 19200 AVR Part : ATmega8 Chip Erase delay : 10000 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 4 20 128 0 no 512 4 0 9000 9000 0xff 0xff flash 33 10 64 0 yes 8192 64 128 4500 4500 0xff 0x00 lfuse 0 0 0 0 no 1 1 0 2000 2000 0x00 0x00 hfuse 0 0 0 0 no 1 1 0 2000 2000 0x00 0x00 lock 0 0 0 0 no 1 1 0 2000 2000 0x00 0x00 calibration 0 0 0 0 no 4 1 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 1 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.07s avrdude: Device signature = 0x1e9307 (probably m8a) avrdude: safemode: lfuse reads as EF avrdude: safemode: hfuse reads as C9 avrdude: erasing chip avrdude: reading input file "0x00" avrdude: writing lock (1 bytes): Writing | | 0% 0.00s ***failed; Writing | ################################################## | 100% 0.12s avrdude: 1 bytes of lock written avrdude: verifying lock memory against 0x00: avrdude: load data lock data from input file 0x00: avrdude: input file 0x00 contains 1 bytes avrdude: reading on-chip lock data: Reading | ################################################## | 100% 0.01s avrdude: verifying ... avrdude: WARNING: ignoring mismatch in unused bits of "lock" (0xc0 != 0x00). To prevent this warning set unused bits to 1 when writing (double check with your datasheet first). avrdude: 1 bytes of lock verified avrdude: reading input file "0xEF" avrdude: writing lfuse (1 bytes): Writing | ################################################## | 100% 0.03s avrdude: 1 bytes of lfuse written avrdude: verifying lfuse memory against 0xEF: avrdude: load data lfuse data from input file 0xEF: avrdude: input file 0xEF contains 1 bytes avrdude: reading on-chip lfuse data: Reading | ################################################## | 100% 0.01s avrdude: verifying ... avrdude: 1 bytes of lfuse verified avrdude: reading input file "0xC9" avrdude: writing hfuse (1 bytes): Writing | ################################################## | 100% 0.01s avrdude: 1 bytes of hfuse written avrdude: verifying hfuse memory against 0xC9: avrdude: load data hfuse data from input file 0xC9: avrdude: input file 0xC9 contains 1 bytes avrdude: reading on-chip hfuse data: Reading | ################################################## | 100% 0.03s avrdude: verifying ... avrdude: 1 bytes of hfuse verified avrdude: safemode: lfuse reads as EF avrdude: safemode: hfuse reads as C9 avrdude: safemode: Fuses OK (E:FF, H:C9, L:EF) avrdude done. Thank you.
D:\working\USBASP-PDI>avrdude -c stk500v1 -p m8 -P COM3 -b 19200 -U flash:w:"main.hex":a avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.04s avrdude: Device signature = 0x1e9307 (probably m8a) avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "main.hex" avrdude: input file main.hex auto detected as Intel Hex avrdude: writing flash (6626 bytes): Writing | ################################################## | 100% 10.10s avrdude: 6626 bytes of flash written avrdude: verifying flash memory against main.hex: avrdude: load data flash data from input file main.hex: avrdude: input file main.hex auto detected as Intel Hex avrdude: input file main.hex contains 6626 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 5.34s avrdude: verifying ... avrdude: 6626 bytes of flash verified avrdude: safemode: Fuses OK (E:FF, H:C9, L:EF) avrdude done. Thank you. |
评论