Sx/b to spin or asm
datacps
Posts: 139
Hello fellow prop squad…..
I completed a project·using a sx/28 chip.
The program and the chip works perfectly. I can send a freqout up to 20Khz with 1 hz accuracy. ·I soon discovered that I needed to cover the entire freq range of a DDS chip with a range of 0 to 30 Mhz. I heard the Propeller can do it with no problem at all.
1. Is there anyway to convert my sx/b to spin or use the compiled ASM code to work with the prop? ·
2. Can the Prop send an accurate frequency from 0 to 30 mhz
3. I need to use a keypad to program the higher frequencies this should not be a problem
4. I use 2 encoders for some sweeps and precise adjustments.
5. I also show the freq readout ·in an 2X16 LCD display
If I stay with the SX chip I would have to ·add a DDS AD9850 chip 14.00 ·and a coprocessor chip for 19.95 plus my SX chip 2.75 . That equals over 36 dollars in chips alone..
I would rather use 1 prop chip for 12.95 and stay with Parallax products.
Any advice would be appreciated …..
·
I completed a project·using a sx/28 chip.
The program and the chip works perfectly. I can send a freqout up to 20Khz with 1 hz accuracy. ·I soon discovered that I needed to cover the entire freq range of a DDS chip with a range of 0 to 30 Mhz. I heard the Propeller can do it with no problem at all.
1. Is there anyway to convert my sx/b to spin or use the compiled ASM code to work with the prop? ·
2. Can the Prop send an accurate frequency from 0 to 30 mhz
3. I need to use a keypad to program the higher frequencies this should not be a problem
4. I use 2 encoders for some sweeps and precise adjustments.
5. I also show the freq readout ·in an 2X16 LCD display
If I stay with the SX chip I would have to ·add a DDS AD9850 chip 14.00 ·and a coprocessor chip for 19.95 plus my SX chip 2.75 . That equals over 36 dollars in chips alone..
I would rather use 1 prop chip for 12.95 and stay with Parallax products.
Any advice would be appreciated …..
·
Comments
(1) The propeller can output square waves of 100 Mhz and above. An issue would be your requirement of 1 Hz precision, which however is not reasonable.
Due to temperature variations you can hardly get anything above 0.01% = 3kHz/30 MHz without seriously tempering with your clock standard, which means paying considerably more than $36... You need calibration anyhow, which however can be accomplished by a cheap trim cap...
Using the 32 bit timers wiil allow a raw NCO frequency of 8 MHz which can be translated to something between
128 MHz and 1 MHz, below that things will become straight forward.
Around 8 MHz you have a precision of 4MHz pr 12.5 ns = 1/20 i.e. a choice from 4 MHz, 4.2 Mhz, ....., 8 MHz
This can most likely be improved much by using the PLL out of spec (which works fine according to my tests)
Note however that this a fundamental issue with generating square waves digitally: Their length has to be a multiple of the clock time. Striving to 0.1% = 1/1000 will not allow more than 12.5 µs = 80kHz
(2) You will not have the slightest chance to re-use any of your SX code
Post Edited (deSilva) : 11/17/2007 8:58:16 AM GMT
Anyway I would suggest that you DO go with the propeller route. It will make things easier in the long run (rather than adding a DDS to the SX/B project) and much more flexible.
As deSilva pointed out, you will not have 1Hz resolution at the higher end (near 30MHz). But I don't think the DDS would either (I've never seen one that would).
Send me an e-mail if you want any assistance. Again sorry if I didn't get back you on the SX project...
Do you have a Prop Demo Board ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·
As to frequency resolution, the big accumulator allows the resolution, averaged over one cycle of the numerical oscillator, to be quite fine. However, put a stress on the phrase averaged over one cycle. One numerical cycle in general takes around one minute. The output at high frequencies may contain considerable amounts of jitter, and the finest frequency steps are the result of infrequent phase corrections, where infrequent may be down to the order of seconds. Whether that matters depends of course on the application. If a DDS chip like the ADS9834 would work, then the Propeller would too, because they have the same operating principle, at least so long as you are after square wave output.
I'm not quite sure what DeSilva has in mind. There is a PLL associated with each of the 16 COG counters. The PLL could smooth out the short term jitter to some extent. The input to the PLL has to be between 4 and 8 mhz, but that can be stretched.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 11/17/2007 8:58:29 PM GMT
At 80mhz clkfreq and a desired frequency of 30mhz, the necessary FRQx value is 16106127360. That is added to the phase accumulator on every clock cycle. Then the example shows the FRQx values that are necessary for 30.000001 mhz, 30.000002 mhz and so on. You see, there is quite a separation in the FRQx values, and the error in the frequency is in the ballpark of millihertz. But remember the emphasis, that this is an average over a complete numerical cycle of about 1 minute. Some earlier threads have discussed these issues at length.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Talking of frequencies is sometimes different from talking about the period of a repeated square with duty cycle 0.5....
When you are striving for the latter it is important to have as much "head room" to 2**31 as possible. A value of 2**21 in FRQA will generate a decent 12 µs high - 12 µs low pulse. The momentary sensitivity will be 25 ns, i.e. 1/1000, allowing you - immediately noticeable! - to change the pulse so that the "frequency" will change from 40,000 Hz to 40,040 Hz.
When applying the PLL you can "boost" that into the 640 kHz area - alas absolutely out of spec, but it will work.
Going to 30 MHz without PLL will not give you not the expected sensible signal but a mixture of 12.5 and 25 ns pulses - adding up well in the long run, no doubt....
Using the PLL will improve this, allowing you to work with %16 values in the register, outputting - unaveraged! - around 20 different pulse lengthes now.
It would be nice if you capitalized the H in Hz as well.
SI prefixes:
http://en.wikipedia.org/wiki/SI_prefix
regards peter
Am I wrong that DDS chips like the AD9834 and the more advanced AD9850 work in the same manner as the Propeller? It comes down to a phase accumulator in NCO mode. The data sheet for the AD9834 is clear about the mechanism, but the data sheet for the AD9850 has more detail about the spectral properties. The big advantage those chips have over the Prop is that they have a very fast parallel SINE conversion and 10 bit parallel DAC. The advantage of the Prop is its programmability.
I think we agree that the waveform is quantized in units of 1/clkfreq=12.5 ns at 80 MHz clock. (Did I abbreviate nanoseconds by the book?) The jitter is substantial at high frequencies where the output is made of high and low periods of only 12.5 or 25 ns. The jitter is substantially less and the spectral purity substantially better at low frequencies where the output is composed of periods of, N*12.5 and (N+!)*12.5 ns, N>>1.
My points with the Excel table is (1) The formula (FRQx = frequency/clkfreq * 2^32) allows frequencies to be specified to the level of sub Hertz. (2) The frequency so calculated is a long term (~1 minute at most) average (3) On the short term there may be jitter and the main frequency component that will be slightly different from the target. All those observations also apply to a DDS chip like the AD9834 or AD9850. Some frequencies will be more "pure" than others, and that depends on the ratio of the desired frequency to the clkfreq.
The PLLs on the propeller counters are quite fast, so I don't think they will allay much of the longer term jitter. The PLL output is still quantized in units of 1/clkfreq.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
deSilva, what's your point here?
,,
http://www.analog.com/Analog_Root/static/techSupport/designTools/interactiveTools/dds/ad9850.html
@Tracy: Yes, "ns" is correct, still no one stood up claiming to be "Mr. Second" "mS" is milli Siemens (=kOhm) as dicussed elsewhere...
Thanks also for the link to the Analog Devices applet for the AD9850. When I look at the results of the applet and the results presented, I still feel that they are missing something fundamental in their explanations. As you know, the AD9850 does not really have 1 hz resolution at 30 MHz, but the applet lets you calculate it anyway. It shows you how close it iis able to approximate that (well within 1 Hz) and shows you the SINC spectrum. But it does not address the subharmonic components that we have been talking about here.
Numerical oscillators have much in common with periodically forced oscillators, where the limit cycle wobbles around on a very long path on the phase plane before it repeats. A numerical oscillator does not wobble, but it too can have a essentially the same long path on the phase plane. When I was in grad school, working on problems in mathematical biology and caught up in the excitement about deterministic chaos, I came across work in subharmonic entrainment by the influential Dutch Electrical Engineer, Balthazar van der Pol. (Does anyone these days name their offspring Balthazar?) I did some theory and experimental work in that area and published in the IEEE Circuits and Systems, and Physica, and American Math Monthly. It is just interesting to me to see this same sort of thing in a different context.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com