rweather / ardpicprog

Arduino-based solution for programming PIC microcontrollers.
GNU General Public License v3.0
70 stars 38 forks source link

Issue writing contents of config memory #10

Closed osvathrobi closed 4 years ago

osvathrobi commented 4 years ago

Here is my output. Everything seems to be fine except I get an error when writing config memory on a Pic16F630. I'm a bit new to PIC programming.

Initialising programmer ...
Device pic16f630, program memory: 1024 words, data memory: 128 bytes.
Erasing and removing code protection.
Burning program memory, 772 locations,
burning data memory, 1 location,
burning id words and fuses,Write to device failed
tomaskovacik commented 4 years ago

try programed pic

maybe it is fine, on my 12f629 ardpicprog also failed for last step and all works fine:

from email communication with Rhys:

I have another problem:
 "burning id words and fuses,Write to device failed"

It depends. I sometimes see that because the read-back doesn't work properly on the config word, or the device hasn't been properly erased. It's PIC-specific - not all of them do it. I suggest reading the contents off the PIC and comparing. If the config word looks OK, you can safely ignore it.

osvathrobi commented 4 years ago

Thank you. I didn't actually test the chip, thought the write failed. But I went ahead, tested it and it was working properly. So the burn was indeed successful. However the error comes up every time I write.

rweather commented 4 years ago

This issue is likely due to the OSCCAL bits in the configuration word. The ProgramPIC sketch takes care not to overwrite them, but then when the read back occurs, the value you asked to write to the config word doesn't match because those bits have changed between your hex file and the actual written value.

Simplest workaround is to read the actual OSCCAL bits from your chip and add those exact bit values to the configuration word in your PIC program. The next time you write, the configuration word will match and it will stop complaining.

osvathrobi commented 4 years ago

Thank you for the clarification. Maybe useful for beginners - if the error message could give a softer error or some mention towards this. (If the other write sequences were correct) Either way thank you for the tool, it came in very handy to mod a SNES with SuperCiC fw.