> Hello Cristiano, >=20 .... > In my case, Texas doesn't guarantee if the flash lock bits would prevent = flash > corruption. > The recommended solution is to add a voltage supervisory IC to protect yo= ur > microcontroller from these external events. >=20 > In order to acknowledge if you are having this problem and not some USB > related issue, I suggest you to pick a good board and read the entire fla= sh > using your programmer, after that, pick a bad board and repeat the proces= s. > Compare the results and you will have the exact location where the > corruption occurred. The corruption may not occur in the same place every time, it could be rela= ted to just which (programming) page of code is being accessed at the time,= or it could be totally random. One of the problems is that Cristiano says: - " The power pins of the pic are directly connected to the power pin of the = usb connector. (there is a bypass capacitor)" Which to me is a no-no. Even with a number of ceramic capacitors for high f= requency bypassing and tantalum (or large value ceramic) this asking for al= l sorts of problems, as the micro will be operating at some unknown voltage= which could be below the minimum operating voltage for the chip. USB power= is notoriously NOT the nominal 5V and I wouldn't connect a micro like this= without having it on a voltage regulator. I suspect this is the base probl= em here, and the Flash memory is operating in a marginal state that sometim= es lets it partially erase over time until it becomes unreliable and it nee= ds reprogramming. Which reminds me, is this chip a 5V one or 3.3V one? If it is a 3.3V one th= en you cannot connect it straight to the USB supply as that voltage will be= too high. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .