Electronics-Related.com
Forums

really slow PLL

Started by John Larkin July 20, 2022
On Fri, 22 Jul 2022 10:54:30 -0700 (PDT), Lasse Langwadt Christensen
<langwadt@fonz.dk> wrote:

>fredag den 22. juli 2022 kl. 16.46.36 UTC+2 skrev Don Y: >> On 7/22/2022 7:17 AM, Don wrote: >> > Don Y wrote: >> >> Don wrote: >> >>> Don Y wrote: >> >>>> bitrex wrote: >> >>> >> >>> <snip> >> >>> >> >>>>> Yeah I don't quite get it, either. My rack of synthesizers can each playone >> >>>>> voice of the Maple Leaf Rag via MIDI and they all stay synced together really >> >>>> >> >>>> How is "really well" defined? In the domain of human auditory perception? >> >>> >> >>> In this case, isn't "really well" defined as an absence of sour note(s)? >> >> >> >> That assumes the synthesis uses the same clock as timing. I think the >> >> discussion here has been wrt durations/intervals. >> >> >> >> How sensitive are *your* ears to noticing small differences in pitch, >> >> absence a comparative reference? Can you discern a difference of a few >> >> cents ("perfect pitch")? >> > >> > Can't everyone's ears (except perhaps the autistic tone-deaf and such) >> > hear a sour note relative to the preceding note? Do you need to name a >> > note (perfect pitch) in order to hear its sourness? >> Perfect pitch is more than just "naming a note". >> > It's all but impossible for me personally to ignore the sourness of >> > cringeworthy, awkward note(s). Sour notes make me want to get out of >> > earshot. >> How "sour" does the note have to be before it is perceptible, as such. >> A cent? Two? Fifty? A semitone?? (about a 25 cents is typical for >> the average, non-musician, listener to be able to detect -- without >> context; i.e., if the "previous note" was similarly sour, your estimation >> of the correctness of the following note can perceive both as correct... >> like singing in an entirely different *key*!) >> >> <https://neurosciencenews.com/pitch-detection-music-21087/> >> >> This is a reference note (middle C) followed by the same note "soured" >> by 12 cents: >> >> <https://en.wikipedia.org/wiki/File:Sines_12_cent_difference.wav> >> >> Chances are, you can't tell the difference hearing them >> in sequence. If you heard just *one*, you'd not be able to tell if it >> was correct, or not. The third sound sample plays both simultaneously >> so you can hear them beating against each other -- the difference then >> becomes very noticeable! >> >> Here's *one* cent difference: >> >> <https://en.wikipedia.org/wiki/File:Sines_1_cent_difference.wav> >> >> And 24 cents (about the point of "normal" perception): >> >> <https://en.wikipedia.org/wiki/File:Sines_24_cent_difference.wav> >> >> If your device's *timing* was off by 0.05%, would that be consequential? > >https://youtu.be/AFaRIW-wZlw?t=54
My recollection is the for a chorus to be in unison, all the singers must be within twenty milliseconds of one another. This is discussed a lot in the computer music literature. Joe Gwinn
On Thu, 21 Jul 2022 04:17:14 -0700, jlarkin@highlandsniptechnology.com
wrote:

>On Wed, 20 Jul 2022 23:49:40 -0700 (PDT), whit3rd <whit3rd@gmail.com> >wrote: > >>On Wednesday, July 20, 2022 at 4:21:08 PM UTC-7, John Larkin wrote: >>> Suppose I have several rackmount boxes and each has a BNC connector on >>> the back. Each of them has an open-drain mosfet, a weak pullup, and a >>> lowpass filtered schmitt gate back into our FPGA. >>> >>> I can daisy-chain several boxes with BNC cables and tees. >>> >>> Each box has a 40 MHz VCXO and I want to phase-lock them, or at least >>> time-align them to always be the same within a few microseconds, >>> longterm. >> >>If you can tolerate 'a few microseconds' on a 40 MHz signal, that's not a phase-lock >>problem, it's a frequency-lock problem. Why not just run an up/down counter >>to generate a correction voltage for each non-leading VCO? > >It's actually a time lock problem. If a follower box starts up and >sees its first 1 PPS input, it can thereafter declare 1 PPS internal >events, based on its local VCO, and then do successive early/late >comparisons to the external pulses. And trim its VCXO accordingly. >
Yes, exactly. And the drift between two reasonably good clocks is slow, so the correction need not and should not be all that fast. What I've done in real applications is to periodically measure the offset between when the external 1PPS is predicted to happen and when it actually does, and adjust the VCO frequency such that in say 50 seconds of roughly linear convergence they will coincide (and keep on going). The process is repeated every few seconds (exact interval not important as it is measured). This is roughly the algorithm a helmsman uses while steering a sailboat, where effect is very much delayed from action. In many computer systems it is quite difficult to do anything on a strict time mark, but easy to measure that actual elapsed time, using the actual clock that is being steered - it all still converges, so long as one doesn't try too hard. So, in your example, the local clock would come from a 40 MHz VCO of good manufacture (probably needs to be a TCXO of some sort). The 40 MHz output would be fed to a divider that puts out a 1PPS pulse train. During initialization, when the first external 1PPS leading edge is received, reset the divider, and start counting 40 MHz cycles. Maybe wait for things to stabilize. Thereafter, measure signed offset between external and internal 1PPS leading edges, and compute how much change (plus or minus) in current VCO frequency is required for zero offset to occur in say 50 seconds (make this time-to-zero an adjustable parameter), and change the VCO control voltage accordingly. A few seconds later (also an adjustable parameter), repeat the above adjustment process, again looking 50 seconds into the future from now. Repeat forever. Steering to within one microsecond should be easy. Any number of units can be following this external 1PPS signal without knowing that one another even exist. Beware of one thing: The 1PPS coax output from many GPS receivers is designed to drive a 50-ohm *resistor*, not a 50-ohm transmission line. You may need a 3dB pad right at the GPS Receiver chassis between 1PPS output and coaxial cable to get sharp leading edges at the far end of the coaxial cable. The classic symptom of trouble is when an o'scope cannot sync reliably to the 1PPS. Also, I'd lose the BNC connectors. Threaded connectors like SMA, TNC, and Type N are far better. Or use shielded twisted pair to carry the 1PPS pulses. This would work better over a backplane. Joe Gwinn
On 7/22/2022 10:03 AM, John Walliker wrote:
> There is cross-correlation between left and right ears in the brainstem which > is involved in determining the direction of sound sources. Detectable time > differences are remarkably small. (I would have to look it up to give a number.)
Direction (as well as elevation) is primarily determined by time differences (Interaural Time Differences -- ITDs) and intensity differences (IIDs) as the head casts an auditory "shadow" on the "far" ear. The shadow attenuates higher frequencies, more. So, the brain localizes different types of sound (frequency ranges) with different mechanisms (low frequencies exhibit less attenuation but have longer periods in which to detect phase differences, etc.) [There's considerable study on this in improving detection of emergency vehicle "sirens" by altering the content of said siren to facilitate this human process] The "wearer's" <grin> pinnae further shape the frequency response so each *individual* can further refine their notion of left/right, front/back, up/down. This is highly "wearer specific", though. Additionally, the presence of reflective surfaces gives multipath information to the listener; one perceives sound differently in open space than in an enclosed room. For repetitive sounds, you can often find folks turning or tilting their heads to better localize the source. You can manipulate the sounds delivered to each ear (via headphones) and simulate the direction of a source, to some degree. I use this "spatializer" effect to differentiate between different message types delivered to a user -- a female voice off to the left might issue reminders while a male voice to the right issues error messages -- both while a "chosen voice" dead ahad provides primary narration. ["Voices" can also be replaced by "annunciators". So, a chime off to one side can be "registered" as having a particular meaning without drawing the user's attention away from the narrative. Empirically, it seems that folks can remember said events, even if one-shots, more than they can remember sequences of sound that is otherwise devoid of message]
Joe Gwinn wrote:

<snip>

> Also, I'd lose the BNC connectors. Threaded connectors like SMA, TNC, > and Type N are far better. > > Or use shielded twisted pair to carry the 1PPS pulses. This would > work better over a backplane.
This is good advice. Even though the lazy guy within me never truly gives up his fight to take the easy way out with BNC. Twisted pair (TP) sounds even easier than BNC. So, what's the "catch" with TP? Where's the "gotcha" to make TP harder than BNC? Danke, -- Don, KB7RPU, https://www.qsl.net/kb7rpu There was a young lady named Bright Whose speed was far faster than light; She set out one day In a relative way And returned on the previous night.
On 7/22/2022 1:01 PM, Joe Gwinn wrote:
> On Fri, 22 Jul 2022 10:54:30 -0700 (PDT), Lasse Langwadt Christensen > <langwadt@fonz.dk> wrote:
>>> If your device's *timing* was off by 0.05%, would that be consequential? >> >> https://youtu.be/AFaRIW-wZlw?t=54
Note context of post...
> My recollection is the for a chorus to be in unison, all the singers > must be within twenty milliseconds of one another. > > This is discussed a lot in the computer music literature.
Things get "painful" at about 50ms. I suspect your brain tries to consider them as different events instead of indistinguishable.
On 7/22/2022 9:02 AM, Don wrote:
> Don Y wrote:
>> In the context of this thread, it likely has an impact. A cent is >> about 500PPM (though in the frequency domain) > > Your question about a one cent following note difference perception is > interesting. And, it needs to be followed up by me, so to speak. :) > For some unknown reason, the only thing to truly satisfy me is to > tune instruments by ear.
You're lucky if you can do so -- to the extent the artist(s) trust(s) your results. I simply want "correct" -- by whatever expedient gets me there, quickest!
On Fri, 22 Jul 2022 21:38:39 -0000 (UTC), "Don" <g@crcomp.net> wrote:

>Joe Gwinn wrote: > ><snip> > >> Also, I'd lose the BNC connectors. Threaded connectors like SMA, TNC, >> and Type N are far better. >> >> Or use shielded twisted pair to carry the 1PPS pulses. This would >> work better over a backplane. > >This is good advice. Even though the lazy guy within me never truly >gives up his fight to take the easy way out with BNC. > Twisted pair (TP) sounds even easier than BNC. So, what's the >"catch" with TP? Where's the "gotcha" to make TP harder than BNC?
Depends on what you are trying to do. For nanosecond edges, coax is pretty useful, but short range and often mechanically awkward. For microsecond edges at 1000 meters, RS422 over shielded twisted pair is pretty good. For bus length links, LVDS or the like. And so on. And there is always optical links. Joe Gwinn
fredag den 22. juli 2022 kl. 23.44.07 UTC+2 skrev Don Y:
> On 7/22/2022 1:01 PM, Joe Gwinn wrote: > > On Fri, 22 Jul 2022 10:54:30 -0700 (PDT), Lasse Langwadt Christensen > > <lang...@fonz.dk> wrote: > > >>> If your device's *timing* was off by 0.05%, would that be consequential? > >> > >> https://youtu.be/AFaRIW-wZlw?t=54 > Note context of post... > > My recollection is the for a chorus to be in unison, all the singers > > must be within twenty milliseconds of one another. > > > > This is discussed a lot in the computer music literature. > Things get "painful" at about 50ms. I suspect your brain tries to > consider them as different events instead of indistinguishable.
afaiu the limit for a phone system is >25ms round trip before you need echo canceling
On 7/22/2022 4:52 PM, Lasse Langwadt Christensen wrote:
> fredag den 22. juli 2022 kl. 23.44.07 UTC+2 skrev Don Y: >> On 7/22/2022 1:01 PM, Joe Gwinn wrote: >>> On Fri, 22 Jul 2022 10:54:30 -0700 (PDT), Lasse Langwadt Christensen >>> <lang...@fonz.dk> wrote: >> >>>>> If your device's *timing* was off by 0.05%, would that be consequential? >>>> >>>> https://youtu.be/AFaRIW-wZlw?t=54 >> Note context of post... >>> My recollection is the for a chorus to be in unison, all the singers >>> must be within twenty milliseconds of one another. >>> >>> This is discussed a lot in the computer music literature. >> Things get "painful" at about 50ms. I suspect your brain tries to >> consider them as different events instead of indistinguishable. > > afaiu the limit for a phone system is >25ms round trip before you need echo canceling
Yes, but that addresses quality. A phone is still usable with noticeable echo, esp if the echo is many dB down. It seems like the brain has some (temporal) threshold beyond which it can no longer treat things as being concurrent and starts a new "recognition process" (so to speak) to deal with the "other" event. E.g., audible feedback on a keypress that is "too late" is more than just annoying; it impacts how you interact with that device. Audio out of sync with video also has an oversized impact on your tolerance for the information channel(s). (*Why* do we care if the lips are out of sync with the sound? It's more than just irritating...)
fredag den 22. juli 2022 kl. 22.37.08 UTC+2 skrev Joe Gwinn:
> On Thu, 21 Jul 2022 04:17:14 -0700, jla...@highlandsniptechnology.com > wrote: > > >On Wed, 20 Jul 2022 23:49:40 -0700 (PDT), whit3rd <whi...@gmail.com> > >wrote: > > > >>On Wednesday, July 20, 2022 at 4:21:08 PM UTC-7, John Larkin wrote: > >>> Suppose I have several rackmount boxes and each has a BNC connector on > >>> the back. Each of them has an open-drain mosfet, a weak pullup, and a > >>> lowpass filtered schmitt gate back into our FPGA. > >>> > >>> I can daisy-chain several boxes with BNC cables and tees. > >>> > >>> Each box has a 40 MHz VCXO and I want to phase-lock them, or at least > >>> time-align them to always be the same within a few microseconds, > >>> longterm. > >> > >>If you can tolerate 'a few microseconds' on a 40 MHz signal, that's not a phase-lock > >>problem, it's a frequency-lock problem. Why not just run an up/down counter > >>to generate a correction voltage for each non-leading VCO? > > > >It's actually a time lock problem. If a follower box starts up and > >sees its first 1 PPS input, it can thereafter declare 1 PPS internal > >events, based on its local VCO, and then do successive early/late > >comparisons to the external pulses. And trim its VCXO accordingly. > > > Yes, exactly. And the drift between two reasonably good clocks is > slow, so the correction need not and should not be all that fast. > > What I've done in real applications is to periodically measure the > offset between when the external 1PPS is predicted to happen and when > it actually does, and adjust the VCO frequency such that in say 50 > seconds of roughly linear convergence they will coincide (and keep on > going). The process is repeated every few seconds (exact interval not > important as it is measured). > > This is roughly the algorithm a helmsman uses while steering a > sailboat, where effect is very much delayed from action. > > In many computer systems it is quite difficult to do anything on a > strict time mark, but easy to measure that actual elapsed time, using > the actual clock that is being steered - it all still converges, so > long as one doesn't try too hard. > > So, in your example, the local clock would come from a 40 MHz VCO of > good manufacture (probably needs to be a TCXO of some sort). The 40 > MHz output would be fed to a divider that puts out a 1PPS pulse train. > > During initialization, when the first external 1PPS leading edge is > received, reset the divider, and start counting 40 MHz cycles. Maybe > wait for things to stabilize. > > Thereafter, measure signed offset between external and internal 1PPS > leading edges, and compute how much change (plus or minus) in current > VCO frequency is required for zero offset to occur in say 50 seconds > (make this time-to-zero an adjustable parameter), and change the VCO > control voltage accordingly. > > A few seconds later (also an adjustable parameter), repeat the above > adjustment process, again looking 50 seconds into the future from now. > Repeat forever. >
isn't that kind how NTP works?, speeding up or slowing down over some period to sync time with the server without big jumps and always increasing (except possibly at start up) come to think of it, some closed loop servo systems (and step generators) for things like CNC machine work similarly at a fixed interval, say a few kHz, current target and actual position is compared, from that (usually with a PI loop) the speed of the motor (or frequency of steps) is set so the position will hit the next target at the next timer tick