本人设计制作的AVR并行解锁器
本人用M16设计制作的AVR_USB_PARAPROG_并行编程器(电路图和固件)。当前固件版本只支持M48,88,168,M8,16,32,64,128的解锁。
可以解锁RST脚设为输出的M8.
固件自动识别芯片型号,解锁,熔丝位恢复出厂设置。
AVR解锁器ourdev_512545.rar(文件大小:32K) (原文件名:并行编程器.rar) 沙发自己坐! 不管怎么样,顶了再说 好东西,顶一个 mark en 支持下 mark 先頂下了! 好东西。 顶一个先 good 使用什么软件啊? 顶一个 好东西顶!
希望能给个实物图。 很好! 用什么软件呀?
顶 mark 解锁不用上位机软件 支持一下。 ;楼主的USB编程和上位机出来了了吗? 兄弟伙,都来乍起哈。。。 very good after download to try.....
thanks... 顶! 顶…………………… 好东西,顶 等我试试看看! 源程序如下,感兴趣的朋友可以进一步完善
//ICC-AVR application builder : 2009-11-24 19:05:01
// Target : M16
// Crystal: 4.0000Mhz
#include <iom16v.h>
#include <macros.h>
//Ports
#define PORTDATA PORTB
#define DDRDATA DDRB
#define PINDATA PINB
#define SET_BS2() PORTA|=0x01
#define CLR_BS2() PORTA&=0xFE
#define POWER_ON() PORTA&=0xf9;
#define POWER_OFF() PORTA|=0x06;
#define SET_RST() PORTA|=0x02
#define CLR_RST() PORTA&=0xFD
#define SET_CLK() PORTC|=0x01
#define CLR_CLK() PORTC&=0xFE
#define RDY (PINC&0x02)
#define SET_OE() PORTC|=0x04
#define CLR_OE() PORTC&=0xFB
#define SET_WR() PORTC|=0x08
#define CLR_WR() PORTC&=0xF7
#define SET_BS1() PORTC|=0x10
#define CLR_BS1() PORTC&=0xEF
#define SET_XA0() PORTC|=0x20
#define CLR_XA0() PORTC&=0xDF
#define SET_XA1() PORTC|=0x40
#define CLR_XA1() PORTC&=0xBF
#define SET_PAGEL() PORTC|=0x80
#define CLR_PAGEL() PORTC&=0x7F
//commands
#define CLR_CHIP 0x80
#define WR_FUSES 0x40
#define WR_LOCKS 0x20
#define WR_FLASH 0x10
#define WR_EEPROM 0x11
#define RD_FLAG_STAND 0x08
#define RD_FUSES_LOCKS 0x04
#define RD_FLASH 0x02
#define RD_EEPROM 0x03
unsigned int SN=16/*M16*/,N_PAGE=128;
unsigned char SIZE_PAGE_FLASH=64/*WORD*/,SIZE_PAGE_EEPROM=4/*BYTE*/,
BUFF_DATA={0xFF,0xFF,0xFF,0xFF,
'A','V','R','_','U','S','B','_','P','a','r','a','P','r','o','g',',',
'D','e','s','i','g','n',' ','b','y',' ','S','K','Y','X','J','H'};
void chip_init(unsigned char f1f2)
{
switch(f1f2)
{
case 0x37: SN=8; SIZE_PAGE_FLASH=32; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x43: SN=16; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x52: SN=32; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=256; break;
case 0x25: SN=48; SIZE_PAGE_FLASH=32; SIZE_PAGE_EEPROM=4; N_PAGE=64; break;
case 0x62: SN=64; SIZE_PAGE_FLASH=128; SIZE_PAGE_EEPROM=8; N_PAGE=256; break;
case 0x3A: SN=88; SIZE_PAGE_FLASH=32; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x71: SN=103; break;
case 0x72: SN=128; SIZE_PAGE_FLASH=128; SIZE_PAGE_EEPROM=8; N_PAGE=512; break;
case 0x41: SN=161; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x44: SN=162; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x42: SN=163; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x4A: SN=164; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x47: SN=165; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x46: SN=168; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x45: SN=169; SIZE_PAGE_FLASH=64; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x51: SN=323; break;
case 0x58: SN=324; break;
case 0x55: SN=325; break;
case 0x53: SN=329; break;
case 0x57: SN=406; break;
case 0x68: SN=640; break;
case 0x69: SN=644; break;
case 0x65: SN=645; break;
case 0x63: SN=649; break;
case 0x73: SN=1280; break;
case 0x74: SN=1281; break;
case 0x81: SN=2560; break;
case 0x82: SN=2561; break;
case 0x56: SN=3250; break;
case 0x54: SN=3290; break;
case 0x66: SN=6450; break;
case 0x64: SN=6490; break;
case 0x36: SN=8515; SIZE_PAGE_FLASH=32; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
case 0x38: SN=8535; SIZE_PAGE_FLASH=32; SIZE_PAGE_EEPROM=4; N_PAGE=128; break;
}
}
void port_init(void)
{
PORTA = 0xFC;
DDRA= 0x03;
PORTB = 0x00;
DDRB= 0xFF;
PORTC = 0x0E;
DDRC= 0xFD;
PORTD = 0xFF;
DDRD= 0x00;
}
void init_devices(void)
{
CLI();
port_init();
MCUCR = 0x00;
GICR= 0x00;
TIMSK = 0x00;
SEI();
}
void delay(unsigned char X)
{
while(X--) NOP();
}
void load_addr(unsigned char addr,unsigned char H)
{
CLR_XA0();
CLR_XA1();
if(H) SET_BS1();
else CLR_BS1();
DDRDATA=0xFF;
PORTDATA=addr;
delay(50);
SET_CLK(); delay(50);
CLR_CLK(); delay(50);
}
void load_data(unsigned char data,unsigned char H)//H为1是装载高位字节,为0时装载低位字节
{
SET_XA0();
CLR_XA1();
if(H) SET_BS1();
else CLR_BS1();
DDRDATA=0xFF;
PORTDATA=data;
delay(50);
SET_CLK(); delay(50);
CLR_CLK(); delay(50);
}
void load_cmd(unsigned char cmd)
{
CLR_XA0();
SET_XA1();
CLR_BS1();
DDRDATA=0xFF;
PORTDATA=cmd;
delay(50);
SET_CLK(); delay(50);
CLR_CLK(); delay(50);
}
void prog_start(void)
{
delay(50);
CLR_WR(); delay(50);
SET_WR(); delay(50);
while(!RDY) NOP();
}
void clr_chip(void)
{
load_cmd(CLR_CHIP);
prog_start();
}
void prog_page_flash(unsigned char PAGE)
{
unsigned char ADDRH,ADDRL,N=0;
ADDRH=PAGE>>1;
ADDRL=PAGE<<7;
load_cmd(WR_FLASH);
while(N<SIZE_PAGE_FLASH)
{
load_addr(ADDRL,0);
load_data(BUFF_DATA,0);
load_data(BUFF_DATA,1);
ADDRL++;
N++;
SET_BS1(); delay(50);
SET_PAGEL(); delay(50);
CLR_PAGEL(); delay(50);
}
load_addr(ADDRH,1);
prog_start();
load_cmd(0);
}
void prog_page_eeprom(unsigned char PAGE)
{
unsigned char ADDRH,ADDRL,N=0;
ADDRH=PAGE>>6;
ADDRL=PAGE<<2;
load_cmd(WR_EEPROM);
load_addr(ADDRH,1);
while(N<SIZE_PAGE_EEPROM)
{
load_addr(ADDRL,0);
load_data(BUFF_DATA,0);
ADDRL++;
N++;
SET_BS1(); delay(50);
SET_PAGEL(); delay(50);
CLR_PAGEL(); delay(50);
}
prog_start();
load_cmd(0);
}
unsigned int read_flash(unsigned int addr)
{
unsigned int data;
load_cmd(RD_FLASH);
load_addr(addr>>8,1);
load_addr(addr,0);
DDRDATA=0x00;
PORTDATA=0xFF;
CLR_OE();
CLR_BS1();
data=PINDATA;
SET_BS1();
data|=(unsigned int)PINDATA<<8;
SET_OE();
return data;
}
unsigned char read_eeprom(unsigned int addr)
{
unsigned char data;
load_cmd(RD_EEPROM);
load_addr(addr>>8,1);
load_addr(addr,0);
DDRDATA=0x00;
PORTDATA=0xFF;
CLR_OE();
CLR_BS1();
data=PINDATA;
SET_OE();
return data;
}
void prog_fuses(unsigned char FUSES,unsigned char H) //H为1时编程高位字节,为0时编程低位字节
{
load_cmd(WR_FUSES);
prog_start();
load_data(FUSES,H);
prog_start();
}
void prog_ext_fuses(unsigned char FUSES)
{
load_cmd(WR_FUSES);
prog_start();
load_data(FUSES,0);
SET_BS1();
SET_BS2();
prog_start();
CLR_BS2();
}
void prog_locks(unsigned char LOCKS)
{
load_cmd(WR_LOCKS);
prog_start();
load_data(LOCKS,0);
prog_start();
}
unsigned int read_fuses(void)
{
unsigned int data;
load_cmd(RD_FUSES_LOCKS);
DDRDATA=0x00;
PORTDATA=0xFF;
CLR_BS2();
CLR_BS1();
CLR_OE();
data=PINDATA;
SET_BS2();
SET_BS1();
data|=(unsigned int)PINDATA<<8;
SET_OE();
return data;
}
unsigned char read_ext_fuses(void)
{
unsigned char data;
load_cmd(RD_FUSES_LOCKS);
DDRDATA=0x00;
PORTDATA=0xFF;
SET_BS2();
CLR_BS1();
CLR_OE();
data=PINDATA;
SET_OE();
return data;
}
unsigned char read_locks(void)
{
unsigned char data;
load_cmd(RD_FUSES_LOCKS);
DDRDATA=0x00;
PORTDATA=0xFF;
CLR_BS2();
SET_BS1();
CLR_OE();
data=PINDATA;
SET_OE();
return data;
}
unsigned char read_flag(unsigned char addr) //addr:0x00,0x01,0x02
{
unsigned char data;
load_cmd(RD_FLAG_STAND);
load_addr(addr,0);
DDRDATA=0x00;
PORTDATA=0xFF;
CLR_OE();
CLR_BS1();
data=PINDATA;
SET_OE();
return data;
}
unsigned char read_stand(unsigned char addr)
{
unsigned char data;
load_cmd(RD_FLAG_STAND);
load_addr(addr,0);
DDRDATA=0x00;
PORTDATA=0xFF;
CLR_OE();
SET_BS1();
data=PINDATA;
SET_OE();
return data;
}
void prog_en(void)
{
POWER_OFF();
CLR_PAGEL();
CLR_XA1();
CLR_XA0();
CLR_BS1();
delay(100);
POWER_ON();
delay(100);
//clr_chip();
prog_fuses(/*read_fuses()&0xF0*/0xE0,0);
SET_RST(); delay(50);
SET_CLK(); delay(50);
CLR_CLK(); delay(50);
SET_CLK(); delay(50);
CLR_CLK(); delay(50);
SET_CLK(); delay(50);
CLR_CLK(); delay(50);
SET_CLK(); delay(50);
CLR_CLK(); delay(50);
CLR_PAGEL();
CLR_XA1();
CLR_XA0();
CLR_BS1();
delay(100);
CLR_RST();
delay(100);
}
void main(void)
{
init_devices();
prog_en();
BUFF_DATA=read_flag(0);
BUFF_DATA=read_flag(1);
BUFF_DATA=read_flag(2);
if(BUFF_DATA==0x1E)
{
if((BUFF_DATA>>4)==9 && (BUFF_DATA>>4)==0)
{
chip_init((BUFF_DATA<<4)|BUFF_DATA);
switch(SN)
{
case 48: {
prog_fuses(0x62,0);
prog_fuses(0xDF,1);
prog_ext_fuses(0xFF);
break;}
case 88:{
prog_fuses(0x62,0);
prog_fuses(0xDF,1);
prog_ext_fuses(0xF9);
break;}
case 168:{
prog_fuses(0x62,0);
prog_fuses(0xDF,1);
prog_ext_fuses(0xF9);
break;}
case 8:{
prog_fuses(0xE1,0);
prog_fuses(0x99,1);
break;}
case 16:{
prog_fuses(0xE1,0);
prog_fuses(0x99,1);
break;}
case 32:{
prog_fuses(0xE1,0);
prog_fuses(0x99,1);
break;}
case 64:{
prog_fuses(0xE1,0);
prog_fuses(0x99,1);
prog_ext_fuses(0xFF);
break;}
case 128:{
prog_fuses(0xE1,0);
prog_fuses(0x99,1);
prog_ext_fuses(0xFD);
break;}
default: break;
}
}
}
load_cmd(0);
SET_RST(); delay(100); //退出编程模式
CLR_RST(); delay(100);
} 好东西,正需要,多谢楼主。 不错。看看先。 不错,谢谢分享 顶起来!! 谢谢楼主...... LZ的共享精神可贺
页:
[1]