The specs in the datasheet tells that accuracy of IMO is +- 5% wich is consistent with the counting error you've got.
To improve accuracy there are two choices coming to my mind:
1st: Using an external oscillator or a 32kHz chrystal
2nd: Calibrating the needed counts/s by measurement and programming the value individually for every device. Here the EEProm usermodule comes in handy to have that information stored
Really :O I allways thought 24mhz would be 24 mhz exactly.
It could be the problem since 5% is 3 sec of 60sec. So it might "fail" like 3-4%.
Thanks for the help, greaaat help.
Ill consider what to do.
Your design goals for accuracy, repeatability, set approach and HW you use
to determine design performance. A xtal is most common approach. The next
step up would be to use a precision external osciullator. For even better results
the following is very effective.
One approach to getting very high accuracy is at production test. Basically you
have a routine inside of PSOC that talks to a high precision external freq counter
and feed an onboard PSOC clk to a pin for the external counter to read. GPIB, USB, UART
commonly used to external counter. PSOC drives a testbed heater/cooler, and records
the external counter and onboard die temp values building a table for generation of
the coefficients to a power fit equation. The table or power curve equation then become
the means for interpreting any value read by PSOC timer/counter. This essentially takes
device to device variation out and corrects for temp. Its only drawback is it does not fix
component aging, but that usually is the lesser problem, or can be characterized and
compensated for. Sounds complicated but really quite simple.
The attached pic shows general idea, in this case replace the precision ref source with
a freq cntr. This pic shows approach to correct A/D and Reference accuracy of a PSOC.
This approach is general.
Hi Precision PSOC Cal1.jpg 56.3 K
Thank you :)
Ofcourse I want it to be effective, but I also need to keep it abit simplified since I do alot different projects. I will use the oscilator idea :)
But thanks for your time, it is awesome that i can get such help in here.
As bob pointed out the issue is because of inaccuracy, but the inaccuracy is around +/- 50% for ILO or 32 KHz clock (IMO has +/- 2.5%). So, you can expect a lot of deviation from the intended time period from device to device and over temperature/voltage range.
And yes, the best solution would be to use an External Crystal Oscillator and use the 32 KHz source. For details on how to use an ECO - refer AN2027 - PSoC® 1 - 32.768 kHz External Crystal Oscillator.
You can also use an external osc feeding a clock to P1_4, in the Mhz range,
24 Mhz for example on a 5V 29xxx type part. See datasheets on other families
for pin and allowed freq in.