Electronic – Factory resetting a PIC16F628

icsppic

I can't get my home brew pic programmer to execute the factory reset sequence correctly (or rather, it's not resetting the device and I can't work out what I'm doing wrong). Other functions such as flashing program memory work fine.

The datasheet specifies the following sequence:

  1. Execute a Load Configuration command (data word 0x0000) to set PC to 0x2000.
  2. Execute Increment Address command 7 times
    to advance PC to 0x2007.
  3. Execute Bulk Erase Setup 1 command.
  4. Execute Bulk Erase Setup 2 command.
  5. Execute Begin Erase Programming command.
  6. Wait Tera + Tprog.
  7. Execute Bulk Erase Setup 1 command.
  8. Execute Bulk Erase Setup 2 command

Note: All bulk erase operations must take place with VDD between 4.5-5.5V.

I think the voltage is good (measures as ~4.8 to 4.9V on the pin) and that I've executed the sequence as stated, but the chip simply does not get reset.

Has anyone else managed to get this done? Was there anything not in the datasheet that might be useful?

This is a problem because I accidentally enabled code protection so the program data is fixed until I can get this to work.

Thanks,
Charlie.

Best Answer

So the datasheet lists Tera as 5ms and Tprog as 8ms, so I thought 13ms would be enough, but increasing the delay to 20ms made it start working.