EmbDev.net

Forum: ARM programming with GCC/GNU tools Code library for ARM7024? - Need DDS 20 like operation!


von Ward C. (wcernuska)


Rate this post
useful
not useful
Hello experts!

Please help me find code to make my ARM7024 act like a DDS 20 uCntrlr...

Here is link to ARM7024:
http://www.futurlec.com/ARM7024_Controller_Tips.shtml

Here is link to DDS 20:
http://www.conrad-direct.co.uk/electronic/20_mhz_dds.sap

DDS 20 is "Not shippable to USA", and it has poor frequency resolution
at higher KHz frequencies, this is why I need ARM7024 to act like a
Frequency Generator, with PWM and Phase Control.

Please advise.

Ward

von Clifford S. (clifford)


Rate this post
useful
not useful
Ward Cernuska wrote:
> Hello experts!
>
> Please help me find code to make my ARM7024 act like a DDS 20 uCntrlr...
>
The DDS 20 is not a microcontroller. It may have a microcontroller on
the board but the DDS will be handled by a dedicated chip (probably an
Analog Devices DDS chip).

> DDS 20 is "Not shippable to USA", and it has poor frequency resolution
> at higher KHz frequencies, this is why I need ARM7024 to act like a
> Frequency Generator, with PWM and Phase Control.

There is no way in the world that a 40MhZ microcontroller is going to be
able to offer 0-20MHz function generation with the performance of the
DDS 20. I would not call 1Hz resolution "poor" in the 10 to 20MHz
range!? The ARM7024 will be far less accurate since the PWM output is
divided down from the micro clock frequency, producing non-linear
resolution.

Clifford

von Ward C. (wcernuska)


Rate this post
useful
not useful
Clifford Slocombe wrote:
> Ward Cernuska wrote:
>> Hello experts!
>>
>> Please help me find code to make my ARM7024 act like a DDS 20 uCntrlr...
>>
> The DDS 20 is not a microcontroller. It may have a microcontroller on
> the board but the DDS will be handled by a dedicated chip (probably an
> Analog Devices DDS chip).
>
>> DDS 20 is "Not shippable to USA", and it has poor frequency resolution
>> at higher KHz frequencies, this is why I need ARM7024 to act like a
>> Frequency Generator, with PWM and Phase Control.
>
> There is no way in the world that a 40MhZ microcontroller is going to be
> able to offer 0-20MHz function generation with the performance of the
> DDS 20. I would not call 1Hz resolution "poor" in the 10 to 20MHz
> range!? The ARM7024 will be far less accurate since the PWM output is
> divided down from the micro clock frequency, producing non-linear
> resolution.
>
> Clifford

Clifford,

Thank you.  I appreciate your authoritative resoponse. I withdraw my
heresay about 'poor frequency sweep resolution'.  I was confused with
PWM resolution at higher frequencies.  Now I understand why from the
ratio of CLK period to Frequency period... this could not be avoided.  I
saw data about PWM accuracy I will find and post back here.   This to
clear up more heresay I've heard about PWM accuracy barrier above
20KHz... hard to believe this per only at 1/2000th of the Max Freq' out.
I will report back on that.  Advise if you can please.

New question:
If I only need 200KHz max, do you think the ARM7024 would then be
cabable of performing decent Freq'-Gen function with its PWM if max
Frequency out is only 200KHz?  I realize development is up to me, but I
want your advice if I'm crazy for trying before I begin.

Ward

von Clifford S. (clifford)


Rate this post
useful
not useful
Read the data sheet do the math!

The ADuC7024 typically runs at Fcore=41.78Mhz, this is teh maximum
frequency and will give the best resolution. The PWM frequency is:

Fpwm = (Fcore/PWMDAT0)/2

The nearest possible frequency to 200kHz is 200.86538kHz (0.43% error).
This is achieved at a PWMDAT0 value of 104, the next lower frequency at
a PWMDAT0 value of 103 is 198.95238KHz and increment of 1.913KHz.

Moreover, PWMDAT0 is a 16bit register, so the maximum value of 65535
yields a minimum frequency of 318.76Hz. At these low frequencies the
resolution is approx 0.005Hz. The only way to get lower frequencies is
to reduce Fcore (via the POWCON register).

Across the range the accuracy of any particular nominal frequency varies
from approx. 0.002% at the low frequency end to 1% at the high frequency
end.

Whether this meets your requirements is up to you.

Note also that the DDS 20 can generate sinusoidal output, whereas the
PWM will only output square waves. You need some sophisticated circuitry
to generate sine waves (hence the DDS 20). Square waves contain
significant high frequency harmonics which may be undesirable -
depending on the application.

Clifford

von Clifford S. (clifford)


Rate this post
useful
not useful
Clifford Slocombe wrote:
> Across the range the accuracy of any particular nominal frequency varies
> from approx. 0.002% at the low frequency end to 1% at the high frequency
> end.

Oops! Flawed math; with correct rounding, the accuracy is approx.
+/-0.001% for LF and +/-0.5% at HF

Clifford

von Ward C. (wcernuska)


Rate this post
useful
not useful
Clifford Slocombe wrote:
> Clifford Slocombe wrote:
>> Across the range the accuracy of any particular nominal frequency varies
>> from approx. 0.002% at the low frequency end to 1% at the high frequency
>> end.
>
> Oops! Flawed math; with correct rounding, the accuracy is approx.
> +/-0.001% for LF and +/-0.5% at HF
>
> Clifford
*****************
Clifford,

Thank you.  I put the formula into a spredsheet and got 0.00002 to
.00005 resolution for ARM7024 for its 318Hz to 20MHz freq' range.  If I
am wrong, no surprise eh?

I was 100% wrong about the DDS 20 having a PWM... I need to be more
careful I see.  Before I end this, please tell me if you know of any
MicrController that can achieve a 10nS minimum time increment from its
PWM.  I hear others are having to use external devices to achieve
this... like AD9834 or AD9833.

Thank you Clifford for your expert assistance!  I do appreciate it.

Ward
******************

von Clifford S. (clifford)


Rate this post
useful
not useful
Ward Cernuska wrote:

> Thank you.  I put the formula into a spredsheet and got 0.00002 to
> .00005 resolution for ARM7024 for its 318Hz to 20MHz freq' range.  If I
> am wrong, no surprise eh?
>
As I said:
Fpwm = (Fcore/PWMDAT0)/2

For PWMDAT0 = 104, Fpwm = (41.78e6/104)/2 = 200865Hz
For PWMDAT0 = 105, Fpwm = (41.78e6/103)/2 = 198953Hz
So for an increment of 1 in PWMDAT0 the change in frequency is 1912Hz

I am not sure what you mean by "0.00002 to .00005 resolution" since you
have not given any units. Which ever way you slice it, there are only
2^16 divisions, you are restricted to 2^16 - 104, so the 'average'
resolution over the range will be about 3Hz but with wide variation from
the low to high frequency

> ... tell me if you know of any
> MicrController that can achieve a 10nS minimum time increment from its
> PWM.  I hear others are having to use external devices to achieve
> this... like AD9834 or AD9833.

For 10ns the clock frequency to the PWM would have to be 100MHz. Most
high speed ARM processors (which would be primarily ARM9 or later
generation devices) do not clock the PWM at the core speed. Moreover
they tend to have more complex clocking schemes. I doubt that you will
get what you need that way.

I imagine the DDS20 is itself implemented using an AD9834 or AD9833 or
similar. If you board has a prototyping area you may be able to rig one
up. I understand that Analog Devices will provide one off free samples
just by filling in a request.

von Ward C. (wcernuska)


Rate this post
useful
not useful
Clifford Slocombe wrote:

> I am not sure what you mean by "0.00002 to .00005 resolution" since you
> have not given any units.


>
> For 10ns the clock frequency to the PWM would have to be 100MHz. Most
> high speed ARM processors (which would be primarily ARM9 or later
> generation devices) do not clock the PWM at the core speed. Moreover
> they tend to have more complex clocking schemes. I doubt that you will
> get what you need that way.
>
> I imagine the DDS20 is itself implemented using an AD9834 or AD9833 or
> similar. If you board has a prototyping area you may be able to rig one
> up. I understand that Analog Devices will provide one off free samples
> just by filling in a request.

Ward

von Ward C. (wcernuska)


Rate this post
useful
not useful
Hmmm.  I'm having trouble posting.  POST TEST!

von Ward C. (wcernuska)


Rate this post
useful
not useful
Clifford Slocombe wrote:
> Ward Cernuska wrote:
>
I meant to say 0.5 to 0.00002 PWM resolution.  I can't seem to attach my
spreadsheet without wiping out text I'm trying to post, so I will try
seperately after this.

At present, there seems no way internally around ARM7024 24nS min pwm
time-increment, but PWM outputs may be "Mixed w. high-speed Gate
Chopping Signal".  See Data Sheet Pg 53, paragraph 6, left side:
http://www.nxp.com/acrobat_download/datasheets/LPC2141_42_44_46_48_2.pdf

Do you think this could help me cull out unwanted protion of PWM pulse
width?  I will ask Analog Devices more questions to be sure.

ARM2148 can multiply its PLL input, 'f-osc', from the internal XTAL to
yield 75MHz out of PLL for the PWM Block for a min pwm time increment of
13.6nS.  Possibly better if this section read two ways (with respect to
f-osc in max Vs w.r.t CCO current controlled oscillator range).  See
spec sheet Pg 21, Section 6.19.1 & 6.19.2:
http://www.nxp.com/acrobat_download/datasheets/LPC2141_42_44_46_48_2.pdf

I will get additional feedback from Analog Devices and Philips to clear
up some doubts while I await you expert advice.  Thank you again
Clifford, please forgive my repeated mistakes.

Ward

von Clifford S. (clifford)


Rate this post
useful
not useful
Ward Cernuska wrote:
> ARM2148 can multiply its PLL input, 'f-osc', from the internal XTAL to
> yield 75MHz out of PLL for the PWM Block for a min pwm time increment of
> 13.6nS.  Possibly better if this section read two ways (with respect to
> f-osc in max Vs w.r.t CCO current controlled oscillator range).  See
> spec sheet Pg 21, Section 6.19.1 & 6.19.2:
> http://www.nxp.com/acrobat_download/datasheets/LPC2141_42_44_46_48_2.pdf

You might look at the LPC3180 (ARM9 @200MHz), not sure about its PWM
capability.

Without knowing what it is you are trying to achieve I cannot really
advise. The initial question is answered - you cannot match the signal
generation performance of a DDS device with a microcontroller.

Beyond that you would have to respecify your requirements, you started
off by suggesting that the DDS 20 had inadequate resolution (@1Hz in
20MHz!), now I have no idea what you want!

All that said, you are as capable of reading a data sheet as me - and
that is all I have done.

Clifford

von Ward C. (wcernuska)


Rate this post
useful
not useful
Clifford Slocombe wrote:
> Ward Cernuska wrote:
>> ARM2148 can multiply its PLL input, 'f-osc', from the internal XTAL to
>> yield 75MHz out of PLL for the PWM Block for a min pwm time increment of
>> 13.6nS.  Possibly better if this section read two ways (with respect to
>> f-osc in max Vs w.r.t CCO current controlled oscillator range).  See
>> spec sheet Pg 21, Section 6.19.1 & 6.19.2:
>> http://www.nxp.com/acrobat_download/datasheets/LPC2141_42_44_46_48_2.pdf
>
> You might look at the LPC3180 (ARM9 @200MHz), not sure about its PWM
> capability.
>
> Without knowing what it is you are trying to achieve I cannot really
> advise. The initial question is answered - you cannot match the signal
> generation performance of a DDS device with a microcontroller.
>
> Beyond that you would have to respecify your requirements, you started
> off by suggesting that the DDS 20 had inadequate resolution (@1Hz in
> 20MHz!), now I have no idea what you want!
>
> All that said, you are as capable of reading a data sheet as me - and
> that is all I have done.
>
> Clifford

Clifford,   Thank you for your continued patience.

I am trying to acieve a 'target' PWM pulse width of 'about' 10nS maximum
pulse-width, while operating in a DDS range of about 30KHz through about
65KHz at least, hopefully much higher.  I understand that requires
100MHz PWM clock and this particular ARM7x family is not that.  This a
personal goal of mine using the simple ARM7x, and I am exploring ways.

Apologies for learning what I want instead of knowing that up front.
I now simply state I am on a mission to achieve this and I am still
considering using the ARM7x to at least control an external method of
delivering such requirements.
A GAL PWM block perhaps with 200MHz CLK who's PWM signature for both
pulse width and frequency are set by the GAL CLKin and edge placement
given to it by the UCntrlr.  Using the same PWM time increment methods
described in the ARM7024 Data sheet.  These 5nS PWM time increments
would be sacrificed / increased towards 10nS resolution, this period
range being dictated by the target frequency I desire do understand.
Hopefully I will find this 5nS period from 200MHz maximum GAL CLK I want
to work with has budget enough to do this.  GAL's only because this is
what I already know how to using AMD PALasm (Vs Lattice ABLE, I never
learned);  far better devices exist I know (Altera/Xylinx).  Maybe I
should just learn them, though I love reverse Boolean, extracting
equations to understand legacy logic examples of this exact same DDS/PWM
synthesis method.  Target frequency dictates minimum time increment of
the PWM.
Alternately, I am exploring using TI CDC5801 phase adjust chips I
already bought, but I confess DDS I do not need this resolution, or
desire real-time interface with it.
Thank you very much Clifford.  Please tell me how to search User List
because it is not alphabetized and I can't find you quickly to PM you it
seems (to reduce this embarrassing public learning!).  My peers watch my
praogress here...:)  I welcome the challenge!

Ward

von Clifford S. (clifford)


Rate this post
useful
not useful
Ward Cernuska wrote:
> I am trying to acieve a 'target' PWM pulse width of 'about' 10nS maximum
> pulse-width, while operating in a DDS range of about 30KHz through about
> 65KHz at least, hopefully much higher.
I think you are making this too difficult. The 30KHz+ signal is easily
generated (although perhaps not with the accuracy you require - you did
not specify that). Use this to trigger a short pulse generator created
from discrete logic (or your preferred programmable logic device). For
example if you connect a single PWM output to both a NOT gate and the A
input of an XOR, then connect the output of the NOT to the B input of
the XOR, the output of the XOR will produce a short pulse for every
rising and falling edge of the PWM. The pulse will be equal to the
propagation delay of the NOT. This may not be long enough, in which case
you simply connect an odd number of NOT gates in series to achieve the
required pulse width. The PWM frequency only need be half the desired
output frequency, which will benefit your resolution.

PWMOUT------------A
        |          XOR-----PULSEOUT
        |---NOT---B

> Thank you very much Clifford.  Please tell me how to search User List
> because it is not alphabetized and I can't find you quickly to PM you it
> seems (to reduce this embarrassing public learning!).  My peers watch my
> praogress here...:)  I welcome the challenge!

At the top of every post the posters name (in red) is a link to the PM
page.

von Clifford S. (clifford)


Rate this post
useful
not useful
Clifford Slocombe wrote:
>
> PWMOUT------------A
>         |          XOR-----PULSEOUT
>         |---NOT---B
>
Oops, trying to type and think at the same time! That would give:

1--------| |---------
0        |_|

Which may be ok, but otherwise use an even number of inverters, or
invert the XOR output. You can use either an odd or even number of
inverters on the input to give finer adjustment on the width, and use an
inverter on the output if necessary to get the correct pulse direction.

If you have a Horrowitz & Hill "Art of Electronics" 2nd ed. it is on the
top of page 557 along with a number of other pulse generators -
including one that uses an RC network to set the pulse time.

Note if you use the XOR circuit I suggested, you need to ensure 1:1
mark-space ratio to ensure even spacing of the pulses. Otherwise use an
AND and an odd number of inverters to create a pulse on just the rising
edge.

H&W never use a single inverter in these circuits, only two or three in
series. I can't help thinking there is a reason for this perhaps.

Anyway the this is what I should have suggested:

 PWMOUT-----------------A
         |               XOR-----PULSEOUT
         |---NOT--NOT---B


Clifford

von Ward C. (wcernuska)


Rate this post
useful
not useful
Clifford Slocombe wrote:

> Note if you use the XOR circuit I suggested, you need to ensure 1:1
> mark-space ratio to ensure even spacing of the pulses. Otherwise use an
> AND and an odd number of inverters to create a pulse on just the rising
> edge.
>
> H&W never use a single inverter in these circuits, only two or three in
> series. I can't help thinking there is a reason for this perhaps.
>
> Anyway the this is what I should have suggested:
>
>  PWMOUT-----------------A
>          |               XOR-----PULSEOUT
>          |---NOT--NOT---B
>
> Clifford

Clifford,

Please exuse my late reply.  I've been away.  Thank you for your
valuable advice.  I have decided to use the 50% duty-cycle you suggest
with external narrow-pulsers, similar to what you have suggested.

I found an idea that will work great for pulses using a 3m transmission
line, shown in Reply #17 here:
http://www.overunity.com/index.php?topic=2582.10  Read all the text in
the picture.  This is a fantastic concept I learned about for AC
Transmission lines, but never thought to use for delivering critically
short pulses.  Forgive me for posting link elsewhere, but I really like
this idea.

I also found an idea to adjust Phase with an 11uS Range while retaining
1nS Resolution between outputs.  This done using Coarse and Fine
Potentiometers in series in a simple RC-timer circuit shown here:
http://www.physicsforums.com/showthread.php?p=1392746  With both of
these pulse-width and phase adjust techniques, I am absolutely
completely satisfied with my ARM7024 uCntrlr.


I have even considered replacing the ARM7024's on-board 41.78 MHz
Crystal with a high quality DDS device to provide Fcore.

I really desire a new DDS design using a device such as the AD9959 Quad
Channel DDS with Phase Shiftable outputs as seen here:
http://www.analog.com/en/prod/0%2C2877%2CAD9959%2C00.html  It is said
you may request samples if you are very nice and can explain why you
deserve them.  My reason was because I can not even buy a DDS-Twenty in
the United States.  I hope to make a DDS using the AD9959 added onto an
ARM7024 as an accessory DDS board someday.  The ARM7024 can display the
frequency I'll bet.  I might be completely ahead of myself, but I dream
BIG.  I now go to learn the trial Keil C Compiler software for my
ARM7024... realizing it allows 16KB max compile unless you buy the
'significant' development package.  Also realizing that I am forbidden
from selling any ARM7024 developed product unless I do purchase the Full
Development Package.  It will take some time for me to learn C.  I
persist.

Thank you for your expert advice Clifford.

Ward

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.