I do find the documentation of how to calibrate the UV sensor a bit sparse.
I have copied the example from "Si114x Programmer’s Toolkit Reference" and modified it to be able to compile with an online GCC (using http://www.tutorialspoint.com/compile_c_online.php)
But since the documentation do not contain any example (with actual numbers) I am not sure if the program works.
My intention was to read-out the 12 bytes of data from the sensor, and put it into my program for generation of the 4 "ucoef" bytes. These could then be hard coded into my MCU program.
Is it possible to get an example of 12 bytes calibration data to 4 "ucoef" bytes ?
The Programmer's Toolkit contains sample code for calibration in the file Si114x_functions.c. This should be a good reference for your code. One thing to note is that the calibration values are individually calibrated. So if you were to store the calculated values to nonvolatile memory, the stored values would only work for that particular device. This is good if you only want to run the calibration calculation on each unit once, but you won't be able to run it on one board and then use the same values for future boards.
Looking into the programmers toolkit is not much help, unless you want to spend hours debugging. In fact i have found two versions one in PDF format "Si114x Programmer’s Toolkit Reference.pdf (release 1.0) and one downloaded from your web site, "install_Si114x_PGM_Toolkit_Release_2_2.exe" Both targeting SI114x. Trying to run both programs (using the online GCC) gives different results.
The release 2_2 version is also using an undocumented Command 0x11 containing something called "the factory calibration index"
I known that each device has its own values, and therefor i save it in persisted area as you suggest. Unfortunate my MCU is so small it cannot contain the calibration code.
Again I would very much appreciate if someone could give me an example of 12+2 bytes input to the 4 bytes of ucoef in order to verify that the program works!