It would be difficult to measure with the onboard micro controller mainly due to the uncertainty over the controller clock accuracy. When the 512Hz is averaged over say 100 cycles, this error adds up in each cycle. Can you use an external oscillator to the microcontroller so that the reference is fixed ? If yes, then you can use timer/counter module of the microcontroller to average the 512Hz signals.
Otherwise I guess you would need a fixed/calibrated external measuring equipment to calibrate all boards.
Thank you for the feedback
I have a fixed controller clock so that may be a good option
I would prefer not to calibrate the clock using calibrated equipment as the temperature at time of calibration will not be the same as the temperature at time of operation
I have also seen that that the 32KHZ clock signal used for the clock is not a very good waveform and this may be the issue
I have attached a scope pic, would you be able to suggest where i should look to solve such issues?
To add information to the question
We started off with Y1 = 32.768 KHz (12pF), XOUT C1 = 12 pF, XIN C2 = 68 pF
Which are as close to the datasheet as possible
I set the SQWE to 1 and SQ1, SQ0 both to 1 to have the CY14C064PA output set to 32768Hz
I have two boards with identical software but different layouts
Board 1 measures 32768Hz and board 2 measures 32766Hz
I have swapped all components between both boards and the accuracy follows the CY14C064PA device
Is this a valid test as i am not using the prescribed 512Hz signal?
I am not using the 512Hz signal as my resolution on the frequency counter does not show enough significant digits
On the 32768Hz signal, you can still use it instead of 512Hz.
I don't have experience of using controller to calibrate the RTC.
If the controller clock is accurate enough across all boards,
using a timer/counter module to count atleast 10000 positive or
negative edges of 32768Hz might give good ppm error (considering 80ns clock inccuracy).
I will check internally and update more info on this.