I am using a PICKit2, pk2cmd, and SDCC to program a PIC18F24J10. In the course of troubleshooting some problems I was having with my code, I upgraded to SDCC 3.4.0. Compiling with the latest version gave me a warning, "The code generated by SDCC does probably not work when XINST is enabled (possibly by default)." So, I've gone ahead and disabled it via

    #pragma config XINST=OFF

And now it doesn't program with pk2cmd, giving me the following error:

    Program Memory Errors

    Address    Good      Bad
    003FFE     00FFFF    00F000
    VDD Error detected. Check target for proper connectivity.

Without the XINST=OFF line, it programs successfully. I can swap back and forth between having no change with Success and having XINST=OFF with Failure.


1 Answer 1


Are you using the right microcontroller definition?

As stated in the device datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/39682E.pdf this microcontroller does not have configuration fuses, it loads the configuration at the end of program memory (0x3ff8 to 0x3fff).

If you extrapolate this to the configuration registers (config1l, config1h, config2l, config2h, config3l, config3h, devid1, devid2) it is the address matching the devid1 register which should be read-only...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.