You may not be able to achieve what you set out to do. When calibrating treat the system as a black box, there are inputs and outputs. Your are trying to find out what goes on inside the box and model it in some way. The model may be easy or it may be difficult. If you can come up with a good enough model, you can calibrate almost anything. If its linear or follows a polynomial relationship it is even easier to calibrate.
You see the system as a box with current in (the actual current which you want to measure) and the black box as your IC/Mosfet and the voltage out of the IC measured by your ADC as the output. Your model is the equation as described above.
With calibration you have to know the inputs and the outputs THIS IS ESSENTIAL!
If K_ILIS were constant your calibration routine could be this
1) Put in a known current like 1Amp (input), measure voltage on ADC (Output)
2) Put in a known current like 2Amps (input), measure voltage on ADC (Output)
(1Amp ADC Val)=680Ω∗(1Amp)/(3V∗kILIS∗4095)
(2Amp ADC Val)=680Ω∗(2Amp)/(3V∗kILIS∗4095)
And the rest is plug and chug. You'll get your value for K_ILIS. This will give you a decent result for the part of the curve that doesn't change (above 3A or so).
If you want to get more detailed, you could do a first order linear fit.
y = m*x + b where y is your ADC measurement (output), and x is your I_L and 680*4095/(K_ILIS*3.3) is your m value. The problem with doing this is you still aren't going to get a good fit. You can only model a line, which would be the equivalent of getting a ruler and drawing a line through the curve, you will still have quite a residual left over in the 0 to 3Amp range.
So another trick in the bag is to move to a higher order like this model:
y= c3*x^3+c2*x^2+c1*x+c0
The problem with this is a line needs at least two points to define it. Fitting a curve would need much more data. There are other fitting functions, a sigmoid might work
y=c2/(c1+exp(c0*t))+b
but these need optimization routines to find all the constants and again, you would want to take as many samples as you could.
One of the problems I see is that K_ILIS is also dependent on temperature and its the junction temperature so that means that if you were to measure it, it would have to happen at the IC. You would have to calibrate it for temperature and know the temperature. It seems the temperature curve of K_ILIS varies from device to device also.
This phrase suggests that K_ILIS is constant on every device but this conflicts with the information in the diagnostic characteristics section, I think its a mixture of the two:
This range for the current sense ratio refers to all devices. The
accuracy of the kILIS can be raised by means of calibration the value
of kILIS for every single device.
So if you were to do a temperature calibration, you would have to know the temperature. Once you knew the temperature you could look up the value of K_ILIS, but you would still have to figure out how it changes over temperature. It doesn't look like you could come up with an easy emperical formula or function (such as an exponential or sigmod). If I were to do this and I had no other way to change the design, I would use the table given to me OR I would run experiment after experiment to characterize K_ILIS over temperature in a lab based setting. Then I would use this data in a look up table on the micro but I would still have to know the temperature. Can you put an thermistor on the IC? Probably not. The current range you are trying to measure is very large. In my experience it is really difficult to get the first 5% of the current measurements range. Part of the problem is there leakage currents and offsets become as large as the voltage measurement from whatever is measuring the current whether it be a differential signal from a sense resistor or via other means.
I think its time you revisit your requirements. It seems you have two or three requirements.
- Simple calibration
- 1% Current measurement accuracy from 0A to 40A (you can insert whatever number you wish for the 1% and 40A)
- Low price
If you have to have 2) and 3) you can't have 1). If you don't need 3) I would consider adding another method for a "high gain" current measurement that would let you zero in on the 0 to 1A range.
I also think part of your problem is not writing requirements in the first place. Its a good way to design things, then you have a discussion of your options before they are on a PCB.