The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
Hi,
I've a problem with the accuracy of the internal clock. At my Netduino, during 24 hours it runs 12 seconds to slow. I want to use the Netduino for ongoing data logging on a SD card and I think it is not usual to synchronise the internal clock every hour.
Of course I could use a time correction factor, but I think the ExtendedTimer events won't be touched by this.
Is this inaccuracy only due to an inproper crystal?
Can the internal clock be adjusted somehow?
Can I use an exact running external oscillator to avoid this inaccuracy?
Thank you for your help,
Claus
have never did a time depending project but I know of the existence of a shield named Real Time Clock Module. Appairently there's a need for such a shield, so I guess it's a common problem.
Is this inaccuracy only due to an inproper crystal?
12 secs on 24h is about 140ppm, and it could be the crystal imprecision, but it is very bad (typically should be under 100ppm).
Can the internal clock be adjusted somehow?
I don't think so. Due to space problems there is no adjustable capacitor for the crystal.
Can I use an exact running external oscillator to avoid this inaccuracy?
You may create your own hi-precision timing source, but it cannot be used as an alias for the standard timing. That is you could feed an input port with a 1Hz clock, then manage an internal counter every edge.
You will have jittering, but the average must adherent to the time-base.
Cheers
Biggest fault of Netduino? It runs by electricity.
Hallo Stefan,
Thanks for your comment.
I use already a DS1307 RTC to set initially the Netduino internal clock. With the inaccuracy of the internal clock I have to do this at least every hour. To set the internal clock from the RTC you have to poll the RTC until a change of the second takes place and then update the internal clock. I want to avoid this often polling, because it may affect the interrupt driven data logging more than necessary.
The best solution would be to get the internal clock more accurate.
Any idea... ?
Thanks in advance
Claus
Hallo Mario,
Thank you for your answer as well.
I thought of adjusting the internal clock (DateTime.Now) via software. But I fear it isn't possible (or is it?).
If only the onboard crystal is accountable for the inaccuracy (is it?) I thougth of applying an external high precision oscillator to the XIN pin of the AT91SAM7X512 (instead of the crystal) by making a little mainboard modification . But the manual is telling something about another timing register setup when an external oscillator is driving the main clock...
Has someone experience with this issue?
Another approach would be to apply a much more accurate crystal. But this would only make sense, if the internal clock is exactly driven by the Crystal, that means, that a 100% accurate crystal would result in an 100% accurate internal clock.
Does anybody know if this is true?
Thanks,
Claus
I thought of adjusting the internal clock (DateTime.Now) via software. But I fear it isn't possible (or is it?).
That is a good question, but I can't answer at the moment.
I would avoid to modify the board, also because the components are really tiny.
A workaround could be taking advantage by the pin 7 of the RTC, that is a 1Hz square wave, by feeding any of the input port. If you configure that port as "InterruptPort", you will obtain an event on any edge of the 1Hz wave.
Within the service routine, you could increment your own private DateTime field of just one second (using the TimeSpan structure).
Of sure it will not an elegant way, but it is even better than a finger in eye.
Tschuss.
Biggest fault of Netduino? It runs by electricity.
Hallo CW2,
sorry, I didn't mean "adjusting the internal clock", I meant "adjusting the accuracy of the internal clock". Is it possible?
Thank you,
Claus
sorry, I didn't mean "adjusting the internal clock", I meant "adjusting the accuracy of the internal clock". Is it possible?
I see. I am not aware of any function that could be used to adjust the accuracy of the internal clock (and there is no calibration mentioned in the microcontroller datasheet). Just out of curiosity, what does your program do? Does it call many managed methods that internally call native functions? Or responds frequently to interrupts? This may cause certain time deviation, because the framework uses so called 'slow clock' with resolution ~21 µs for time functions. If you create a trivial program that does nothing (e.g. Thread.Sleep(Timeout.Infinite)) and displays the current time in response to an external event, which may be precisely timed, you should be able to verify whether the time deviation is caused by the oscillator (you will get the discrepancy too) or by the CLR execution engine.
Netduino uses crystal oscillator ABM7-18.432MHZ-10-D2Y, which according to the datasheet has frequency tolerance ±20 ppm and stability ±30 ppm. The microcontroller supports external clock source and also has Real-time Timer, both would require changes in the firmware.
If you feel comfortable with the electronics try adding some capacitance in parallel with the crystal.
Also if you have access to a frequency counter you can check the oscillator frequency.
It does seem to me that you should be seeing better accuracy than you are getting, but keep in mind that things like temperature affect frequency.
Netduino uses crystal oscillator ABM7-18.432MHZ-10-D2Y, which according to the datasheet has frequency tolerance ±20 ppm and stability ±30 ppm. The microcontroller supports external clock source and also has Real-time Timer, both would require changes in the firmware.
That is another bad new I won't ever hear, but it seems so...
It seems that the internal RTC is totally software based, without any sync with a MCU timer.
At this point, it is clear that has not any sense adjusting the circuitry around the crystal.
Biggest fault of Netduino? It runs by electricity.
I am not aware of any function that could be used to adjust the accuracy of the internal clock (and there is no calibration mentioned in the microcontroller datasheet).
The Application Note describes a method to improve the accuracy of a Realtime Timer when it is used as a Real-time Clock. A special hardware process, "Timing Interval Acquisition" (TIA), has been developed and is embedded in AT91SAM7S and AT91SAM7X products.
"Netduino uses crystal oscillator ABM7-18.432MHZ-10-D2Y, which according to the datasheet has frequency tolerance ±20 ppm and stability ±30 ppm. "
i am try to make own pcb with the netdunio plus schemetic. currently, when i plug the usb onto my computer, it says unknown device. but i can upload the netdunio mini firmware through DBUG pins.
i think the problem may causing by the main crystal i used.
from at91sam7 datasheet Page615.
CL (6) Equivalent Load Capacitance Integrated Load Capacitance (XIN and XOUT in series) 20pF
CLEXT (6) Maximum external capacitor on XIN and XOUT 10 pF
by using ABM7-18.432MHZ-10-D2Y the External Load Capacitance will be 10*10/(10+10)+ 5pf(inconsideration of track...)=10pf, this seem did not consider internal equivalent load capacitance. i am not using this crystal at moment. why this mcu only allow max of 10pf load capacitance? this is not common on market, unless i order it.
hope someone help me to understand this. appreciated