HI its working now here is at least the secuence that i used based on the Data sheets
you might notice a litle ASM{ ..} Block well i did that because the CodeWarrior wasnt executing does rutines.. when i use the DISASSEMBLE tool it was jumping them so for any one that this coul be helpful
thanks ALBAN
void FlashUnLock()
{
Reset_Target();
Send_BDM_Byte(ACKEN);
//MASS ERASE EEPROM
Delay();
WriteData(WRITB, 0x0110,0x3200);//eclk
WriteData(WRITB, 0x0114,0xFF00);//eprot
WriteData(WRITB, 0x0115,0x0030);//estat reg
WriteData(WRITW, 0x0118,0x0000);
WriteData(WRITW, 0x011A,0x0000);
WriteData(WRITB, 0x0116,0x4100);
WriteData(WRITB, 0x0115,0x0080);
Delay();
//MASS ERASE FLASH
WriteData(WRITB, 0x0100,0x3200); //clk
WriteData(WRITB, 0x0103,0x0000); //cnfg
WriteData(WRITB, 0x0102,0x1000); //mod
WriteData(WRITB, 0x0104,0xFF00); //fprot
WriteData(WRITB, 0x0105,0x0030); //fstat
WriteData(WRITW, 0x0108,0x0000);//faddr
WriteData(WRITW, 0x010A,0x0000);//fadata
WriteData(WRITB, 0x0106,0x4100);
WriteData(WRITB, 0x0105,0x0080);
Delay();
asm
{
JSR Reset_Target
JSR Delay
JSR Delay //WATING FOR THE BDM FIRMWARE TO FINISH THE BLANK CHECK
}
Send_BDM_Byte(ACKEN);
//REPROGRAM THE SECURITY BYTE
WriteData(WRITB, 0x0100,0x3200);//clk
WriteData(WRITB, 0x0103,0x0000);//cnfg
WriteData(WRITB, 0x0104,0xff00);//fprot
WriteData(WRITW, 0xFF0E,0xFFBE); //flash
WriteData(WRITB, 0x0106,0x2000); //cmd
WriteData(WRITB, 0x0105,0x0080); //stat
Delay();
Reset_Target();
Delay();
Send_BDM_Byte(ACKEN);
}
Message Edited by Franky_TJ_ on 2006-10-1808:56 PM