Saturday, October 22, 2016

How to Solve: Target Device has Invalid Calibration Data (Microchip PIC)

Micro-controllers are great devices, but sometimes we face few problems which are not common to all, and they waste our huge time. In this post i will discuss one of such problem which i faced while using the Microchip PIC12F675 Micro-controller and then how to solve this problem.
I purchased this micro-controller from the local market (Though i purchased all micro's locally :-P, but i haven't face such issue with any micro-controller).
The problem occurs when i try to program this micro-controller, whenever i try to program it, i get the error Target Device has Invalid Calibration Data (0x00), i am shocked at that time, that why i am getting this error, i purchased three micro's and all are giving the same error.
I searched on internet and datasheet, that what this error is all about, and i came to know, that these micro's has some bits in the Program Memory, which are programmed during production and it might be possible that i accidentally erased them or they are not programmed at factory production time. That's the drawback of purchasing the micro-controller from local market, usually big companies sell such products in at low prices in gray market and then they available locally in shops.
So this is all about the problem, now coming to its resolution. First of all, this will not affect much, it just means the OSCCAL value is incorrect. It is the last instruction in memory (the reset vector) and should be a 'movlw xx' instruction where xx is the calibration value for the internal clock oscillator. All it's telling us is the instruction appears to be something else. Either you erased it or your program has placed another instruction at that address. It won't stop the PIC working and there is no obligation to use the value anyway if you are happy that the clock may be slightly off frequency.

But if still you want to remove this error, then follow these steps:

  • Open MPLAB, and then go to project properties.
Step-1
  • In Config, Select the debugger you are using and after that, in Option Categories, select program option and then check the Program Calibration Memory and then click on apply button.
Step-2
  • Now in XC8 Global Option, in Option Categories select the Runtime and then check the Calibrate Oscillator, and then click on apply button then Okay.
Step-3

Now you are done, you will not see the Target Device has incorrect calibration value error again for that micro-controller.  

3 comments:

  1. This solution doesn't work when using MPASM. is there a solution when using MPASM, simply checking "program calibration memory" doesn't solve the issue.

    ReplyDelete
  2. Right now i don't have any micro-controller with this problem so can't vetify. Will try to find solution for this and update you here.
    One work around I can think of right now is that, create a project using xc8 compiler and fix the issue like done above, and then open your assembly project and uncheck the debugger setting to program this part.
    I think this might fix the issue.

    ReplyDelete