In JTAG430_WRITEFLASH, the write is attempted twice if unsuccessful the first time.
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@172
12e2690d-a6be-4b82-a7b7-
67c4a43b65c8
//Pulse TCLK
jtag430_tclk_flashpulses(35); //35 standard
//Pulse TCLK
jtag430_tclk_flashpulses(35); //35 standard
}
//! Configure flash, then write a word.
}
//! Configure flash, then write a word.
case JTAG430_WRITEFLASH:
//debugstr("Poking flash memory.");
jtag430_writeflash(cmddataword[0],cmddataword[2]);
case JTAG430_WRITEFLASH:
//debugstr("Poking flash memory.");
jtag430_writeflash(cmddataword[0],cmddataword[2]);
+
+ //Try again if failure.
+ if(cmddataword[0]!=jtag430_readmem(cmddataword[0]))
+ jtag430_writeflash(cmddataword[0],cmddataword[2]);
+
+ //Return result.
cmddataword[0]=jtag430_readmem(cmddataword[0]);
cmddataword[0]=jtag430_readmem(cmddataword[0]);
txdata(app,verb,2);
break;
case JTAG430_ERASEFLASH:
txdata(app,verb,2);
break;
case JTAG430_ERASEFLASH:
- jtag430_eraseflash(ERASE_MASS,0xFFFE,0xFFFF);
- jtag430_eraseflash(ERASE_MASS,0xFFFE,0xFFFF);
- jtag430_eraseflash(ERASE_MASS,0xFFFE,0xFFFF);
+ jtag430_eraseflash(ERASE_MASS,0xFFFE,0x3000);
txdata(app,verb,0);
break;
case JTAG430_SETPC:
txdata(app,verb,0);
break;
case JTAG430_SETPC:
default:
jtaghandle(app,verb,len);
}
default:
jtaghandle(app,verb,len);
}
+ //jtag430_resettap(); //DO NOT UNCOMMENT
// At 16MHz, 33 to 62 cycles/loop are allowed.
jtag430_tclk_flashpulses_3mhz:
mov #0x0031, r14
// At 16MHz, 33 to 62 cycles/loop are allowed.
jtag430_tclk_flashpulses_3mhz:
mov #0x0031, r14
bis.b #2, @r14 ;SETTCLK, 3 cycles
sub #1, r15 ; 1 cycle
;; 1+3+3+1+2=10, within limits
bis.b #2, @r14 ;SETTCLK, 3 cycles
sub #1, r15 ; 1 cycle
;; 1+3+3+1+2=10, within limits
+ nop
+ nop
+ nop ;10+3=13
+
bic.b #2, @r14 ;CLRTCLK, 3 cycles
tst r15 ; 1 cycle
jnz pulseloop3 ; 2 cycles
bic.b #2, @r14 ;CLRTCLK, 3 cycles
tst r15 ; 1 cycle
jnz pulseloop3 ; 2 cycles