Best way to clock MCU for precision timing application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Best way to clock MCU for precision timing application

Jump to solution
1,665 Views
Smiffytech
Contributor III

I am working on a number of clock designs (as in things that tell the time,) all of which will be based around and MC9S08AC128. The timing source will be a DS32KHZ 32768 Hz TCXO.

 

Whilst I can clock the MCU from the DS32KHZ, feeding into EXTAL, and then deriving internal clocks from the FLL (or so I understand,) for the purposes of doing something every second (32,768 'ticks' of the oscillator,) is it best to do this, or use some other clock source for the device (such as internal) and just have the DS32KHZ driving an external interrupt? I assume there must be some sort of best practice in this type of scenario.

 

My goal is for the devices to keep good time - I'm not fussed about whether displays might refresh a few milliseconds early or late - as human eyes will never notice. (But they will notice how far the things drift from atomic time, over time.)

 

In case it has any bearing on the matter, firmware will be created using CodeWarrior, making as much use of Processor Expert as possible.

Labels (1)
0 Kudos
1 Solution
1,260 Views
Encoder1
Contributor III

FLL internal clock is reasonable precise for low-critical timing application. I use it in many control loop where 1% precision is ok, i.e. most of all, driven by the internal oscillator.

FLL multiplication is quite precise but I would not depend on it: perhaps may be better than 0.1% but it is affected from some jitter. I do not know how precise is in absolute the average multiplication, if it keeps track of the pulses in excess or under-rate.

I would implement a bus-clock driven basic timer, adjusting it by an external interrupt driven input from your VCO. 1s or 2s pace is ok: an externally clock driven timer used as divisor to divide VCO by 32768 or 65536 to generate this interrupt could be the best solution.

Salvatore

View solution in original post

0 Kudos
4 Replies
1,260 Views
bigmac
Specialist III

Hello Mathew,

Using the resources that reside in the 'AC128, another method would be to use FEE mode for the ICG module, and then utilize the RTC, driven by the ICGERCLK signal, to generate a periodic interrupt, or wakeup from stop mode, at precise one second intervals.  Assuming a BDIV factor of 1, the ICG can be configured to generate a bus frequency within the range 4.194304 MHz to 18.874368 MHz, in steps of 1.048576 MHz.

Regards,

Mac

1,260 Views
Smiffytech
Contributor III

Thanks, Mac - that gives me another option.

I'm trying to figure out a standard-ish clock module that can work with a number of display technologies (Nixie, VFD, etc,) and also work with different battery-backed RTCs, the latter to give cost options. (The DS3234 isn't exactly a budget part.) Some of the RTCs have a seconds option, but others only a 32kHZ output, so having different configuration options for the MCU gives me a bit of flexibility there.

Cheers

M

0 Kudos
1,261 Views
Encoder1
Contributor III

FLL internal clock is reasonable precise for low-critical timing application. I use it in many control loop where 1% precision is ok, i.e. most of all, driven by the internal oscillator.

FLL multiplication is quite precise but I would not depend on it: perhaps may be better than 0.1% but it is affected from some jitter. I do not know how precise is in absolute the average multiplication, if it keeps track of the pulses in excess or under-rate.

I would implement a bus-clock driven basic timer, adjusting it by an external interrupt driven input from your VCO. 1s or 2s pace is ok: an externally clock driven timer used as divisor to divide VCO by 32768 or 65536 to generate this interrupt could be the best solution.

Salvatore

0 Kudos
1,260 Views
Smiffytech
Contributor III

Thanks, Salvatore.

I guess that, from a time-keeping point of view, it's maintaining an accurate count that's important as displaying it would hardly be considered as real-time, considering the requirements of human vision.

Looking at various RTC chips, some have 32768Hz outputs - which I can use with your externally clocked timer method - and others (I'm thinking of using the DS3234, which has it's own on-board TCXO) can be made to 'tick' once a second, which I could use to fire the latch of the shift registers that are actually driving the display parts.

It's all clear in my head now, so thanks again for your input!

0 Kudos