Page 1 of 1
External clock
Posted: Wed May 03, 2017 2:48 pm
by BobF
Ok gang,
I have another crazy question for you all to ponder. I am working on another crazy device, but it needs a clock in the megahertz range. Since I can not generate this high frequency internally, is it possible to bring it in externally? Would it then even work if I can bring in the high frequency clock?
Thanks all!
Later then, BobF.....
Re: External clock
Posted: Wed May 03, 2017 5:54 pm
by Spogg
I believe the limit is the sample rate Bob, so typically 44.1khz would be the maximium.
Cheers
Spogg
Re: External clock
Posted: Wed May 03, 2017 8:51 pm
by KG_is_back
In theory you can oversample the streams into megahertz range. One way to do this is using "loop" in code component. All the oversampled code must be inside that loop or you need to setup some buffers to transfer data between components.
That said, MHz is just 3 orders of magnitude from frequencies at which processors operate. That means you only have a few hundred instructions per sample (at best) before you run out of time. It will probably be even less, because your RAM access may become a bottleneck.
Typically, this kind of processing is done using GPU if it's possible to write it down the operations on samples as parallel instead of sequential.
Re: External clock
Posted: Wed May 03, 2017 9:22 pm
by BobF
Thanks for the comments guys!
Say KG_is_back, if I could get away with say 100K to 500K would that be better and do you have an example I would understand?
What I need is a square wave clock frequency of 100K Hz to 500K Hz if possible!
Thanks again for your help, BobF.....
Re: External clock
Posted: Wed May 03, 2017 10:16 pm
by KG_is_back
wait... so you are trying to output analog clock (presumably via soundcard DA output)? Presumably to drive some sort of external device? I'm afraid that is not practically possible. Even if you would have a soundcard beefy enough to output that, the actual analog output on most soundcards is actually low-passed at about 20kHz. If you need MHz speed square-wave clock I suggest going the analog route. It should be possible to find such clocks that have frequency controlled via micro-controller.
If what you are trying to do is the other way around - using MHz analog clock as an input, the same problems apply. Except in this case the clock would be basically pointless - your operating system can't respond quickly enough to make out anything useful out of it, other than taking it in as regular audio stream input.
I again would suggest going an analog route. Find a device that converts frequency of input signal into DC voltage (presumably a low/high pass filter attached to a high-frequency rectifier of some sort) and use some analog pin to readout the value by your computer.
Re: External clock
Posted: Thu May 04, 2017 7:44 pm
by BobF
Hello KG,
Sorry this is late, been busy taking care of my granddaughter.
Here is what I have been working on, see attached.

- SigmaDeltaMod.png (10.46 KiB) Viewed 18009 times
Guess I will just self it for now.
Thanks for all your help, BobF.....