Restarting COG Counters CTRA/B Time?
jazzed
Posts: 11,803
Several times now over the last year I've been in a position where I want to restart the CTRA time base to synchronize NCO pulses to given events. I thought one could do it with a write to PHSA, but that doesn't seem to have any effect either - although the phase relationships still seem to work. ??
Also, is there a known working example where Propeller running at 80MHz produces a 160MHz clock with CTRA?
Also, is there a known working example where Propeller running at 80MHz produces a 160MHz clock with CTRA?
Comments
As to your first question, could you rephrase it? Everyting after "but that..." gets kind of muddled and hard to parse.
-Phil
Does NCO with FRQA = $8000_0000 create an 80MHz clock assuming 5MHz in and PLL16? It's really hard to measure on my scope.
-Phil
So with PLL mode, will the clock be the same phase as system clock?
I'm seeing jitter with respect to pin states set by OUTA, so PLL mode doesn't seem to be useful for relative OUTA settings.
The spec is difficult at best in this area. How do you calculate VCO for example?
When it says VCO, does it mean _xinfreq * pll * 8 ? (5MHz * pll16x * 8 in my case)
CTRA 00010_100 << 23 seems to give 80MHz ... so this means VCO is 640MHz ?
Post Edited (jazzed) : 12/3/2009 5:26:10 PM GMT
-Phil
NCO = _xinfreq * pll / 2 ????????????
VCO = NCO * 16
APIN = VCO/8 = (00010_100 << 26)
Until I hear differently, I will take NCO frequency (for 5MHz PLLx16) as NCO = xinfreq * pllx16 / 2 = 80MHz/2 = 40MHz.
Still, the original question is resolved as I have firm control of the square wave NCO start time relative to OUTA transitions.
PLL mode is unreliable with respect to OUTA transitions from what I see, so that only has value to me in other applications.
Thanks Phil.
--Steve
····frqa = fNCO * 232 / clkfreq
-Phil
This is clear if fNCO is understood to be the input frequency which is apparently different from NCO = FRQA with PHSA[noparse][[/noparse]31].
Of course with FRQA = $8000_0000 = 2/**31, FRQA / 2**32 = 2.
Obviously something is lost somewhere in translation.
Solving for fNCO in your formula says NCO = CLKFREQ (80MHz = 5MHz xtal * 16) because FRQA / 2**32 = 1.
This is not consistent with my observation.
Post Edited (jazzed) : 12/3/2009 10:08:18 PM GMT
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 12/3/2009 9:25:18 PM GMT
This is different than the definition of NCO at the end of exactly the same paragraph!
Incredibly confusing !!!
So, if you split hairs and say fNCO = 4 - 8MHz and NCO = result of FRQA and PHSA[noparse][[/noparse]31], then:
NCO = (FRQA / 2**32) * fNCO * PLLx16 (for fNCO = 5MHz, NCO = 40MHz) .... then:
VCO = NCO*16
APIN frequency = VCO / divisor (PLLDIV number 4 makes divisor 8 and thus 80MHz is APIN frequency).
What a mess!
Solving for FRQA as you mentioned is correct: FRQA/2**32 = 2 if FRQA = 2**31 = $8000_0000
Still, the terminology is friggin' confusing no ?
-Phil
_
The NCO output and FRQA + PHSA[noparse][[/noparse]31] relationship is not clear on the picture.
I might add the expressed equation later.
--Steve
Post Edited (jazzed) : 12/4/2009 12:04:18 AM GMT
As an example, suppose you want the counter to output 35MHz to a pin. First you have to figure out a value for fNCO that's between 4 and 8 Mhz. Now, 35 MHz / 4Mhz is 8.75, so we'll pick a
Ok, so I want 80MHz output on APIN and I have an 80MHz system clock.
frqx = 80M*2**32/80M = 2**32 = $1_0000_0000, but that doesn't work so I have to have highest rate 40M*2 ... thus
frqx = 40M*2**32/80M = 2**31 = $8000_0000, so we have to set PLL bits in CTRA (00010_100 << 23).
What is the frequency produced by the counter NCO in this example ?
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.
Nice solution Jonathan.
-Phil