External clock

For general discussion related FlowStone
Post Reply
BobF
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

External clock

Post 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.....
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: External clock

Post by Spogg »

I believe the limit is the sample rate Bob, so typically 44.1khz would be the maximium.

Cheers

Spogg
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: External clock

Post 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.
BobF
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: External clock

Post 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.....
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: External clock

Post 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.
BobF
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: External clock

Post 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
SigmaDeltaMod.png (10.46 KiB) Viewed 18014 times


Guess I will just self it for now.

Thanks for all your help, BobF.....
Attachments
SigmaDeltaMod.png
SigmaDeltaMod.png (10.46 KiB) Viewed 18014 times
Post Reply