Quote Originally Posted by LinkMTech View Post
I noticed the variable "x" missing I hope will help.

Code:
    for x = programStart to $1767F step 64
       Flash = x
       ERASECODE Flash
    next x
Thank you for the answer.
Unfortunately is not that the problem...

I've found that for some reasons, the device showing-up that behaviour (the one I've under test), had the configuration bits named BBSIZ - set to 4K words of the Boot record AND the config bit WRTB (boot block write protection set too!!!)
Seems that this prevent ERASECODE / WRITECODE to deal with the first 4K of code words.

The only one lifesaver is: how to change the configuration bits programmatically?
This topic maybe deserve a different thread...

BTW, thank you for taking time to look at it.