Be Excellent To Each Other
Offline
God Member
Karma: 8
Posts: 857
|
 |
« on: November 24, 2012, 01:22:25 am » |
With some code from "stimmer" I did the old standby of banging a square wave from an Arduino Due using digitalWrite and then doing it again using port manipulation. Port manipulation accomplishes a 21 Mhz "square" wave, exactly 1/4 of the rated clock speed of 84 Mhz. It's not that square, though I guess it would trigger a digital input fine. FWIW, the waveform it does make it certainly does reproduce the same way each time though. Is that right, is this a clean enough square wave to use with most other digital ICs? digitalWrite:  Port manipulation: 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 76
Posts: 6849
Arduino rocks
|
 |
« Reply #1 on: November 24, 2012, 01:33:04 am » |
Your scope is 70MHz I believe, so a 20MHz square wave will only show upto the third harmonic...
|
|
|
|
|
Logged
|
|
|
|
|
Be Excellent To Each Other
Offline
God Member
Karma: 8
Posts: 857
|
 |
« Reply #2 on: November 24, 2012, 01:36:47 am » |
Your scope is 70MHz I believe, so a 20MHz square wave will only show upto the third harmonic...
Now I do not know a lot about scopes, I've got more scope here than knowledge for sure, but it's a digital scope with a 2GS/s sampling rate. I'm pretty sure it uses all the sampling ability even though it (in software!) limits the maximum resolution to 70mhz (and they spec different probes for over 100Mhz too). That is interesting, though, I am going to have to borrow a better scope and try it out on another one.
|
|
|
|
|
Logged
|
|
|
|
|
the land of sun+snow
Offline
Edison Member
Karma: 91
Posts: 2239
|
 |
« Reply #3 on: November 24, 2012, 01:43:56 am » |
Hmmm, all that ringing on the signal leads me to believe you don't have the "ground" wire on the scope probe positioned properly. It should be connected to the ground point nearest the signal being measured, and not somewheres on the other side of the board, etc.
Plus you should darn well be using a 10X scope probe for high-frequency measurements.
|
|
|
|
|
Logged
|
Something different - Kitchen-Sink Arduino-compatible boards
|
|
|
|
Be Excellent To Each Other
Offline
God Member
Karma: 8
Posts: 857
|
 |
« Reply #4 on: November 24, 2012, 01:52:26 am » |
Hmmm, all that ringing on the signal leads me to believe you don't have the "ground" wire on the scope probe positioned properly. It should be connected to the ground point nearest the signal being measured, and not somewheres on the other side of the board, etc.
Plus you should darn well be using a 10X scope probe for high-frequency measurements.
OK, I am willing to take instruction here for sure. The way I have this set up I have, and maybe this is too long, a 3" jumper on the 2 pin on the Arduino board and a 2" jumper on GND nearest that pin and I have the probes attached with alligator clip (gnd) and hook clip (2 pin) the jumpers. I calibrated the probes prior to taking the measurement. Where the scope says "DC 10:1" I am pretty sure that means it is in the 10X mode - it said it was in another menu as well. These probes are Agilent N2862B 10:1 150Mhz passive probes. There is no 1:1 option. What should I do differently? Thanks for suggestions!
|
|
|
|
« Last Edit: November 24, 2012, 02:09:50 am by JoeN »
|
Logged
|
|
|
|
|
Be Excellent To Each Other
Offline
God Member
Karma: 8
Posts: 857
|
 |
« Reply #5 on: November 24, 2012, 01:59:51 am » |
OK, I shoved a couple of 1 pin male headers in there to keep it as short as possible. Much better now. Anything else I can do to improve it? 
|
|
|
|
« Last Edit: November 24, 2012, 02:06:46 am by JoeN »
|
Logged
|
|
|
|
|
the land of sun+snow
Offline
Edison Member
Karma: 91
Posts: 2239
|
 |
« Reply #6 on: November 24, 2012, 02:13:38 am » |
Looks much better now, although the probe grounding could probably be improved a bit. Most important is the total length of the probe ground wire, including extensions, be the minimum possible. The longer wire produces a big inductive loop that rings and propagates noise like a loop antenna.
Now, when feeding your 20-Mhz signal out to the rest of the world, you can try using a small value R [ie, 22 or 47 ohms] in "series" in the "output" line, to limit ringing. Look up something called "source series termination".
|
|
|
|
|
Logged
|
Something different - Kitchen-Sink Arduino-compatible boards
|
|
|
|
Be Excellent To Each Other
Offline
God Member
Karma: 8
Posts: 857
|
 |
« Reply #7 on: November 24, 2012, 02:58:34 am » |
Looks much better now, although the probe grounding could probably be improved a bit. Most important is the total length of the probe ground wire, including extensions, be the minimum possible. The longer wire produces a big inductive loop that rings and propagates noise like a loop antenna.
Now, when feeding your 20-Mhz signal out to the rest of the world, you can try using a small value R [ie, 22 or 47 ohms] in "series" in the "output" line, to limit ringing. Look up something called "source series termination".
So I have gotten the leds from the Arduino as short as possible to the probe and grounding clip. The probe itself as provided by Agilent has a hook for the probe and a grouding clip that you hook onto the probe around the neck where the wire itself is 3.5" long and it is extended in length with a crescent clip on one end to attach to the probe and the alligator clip on the other. The spec on the probe wire is 1.2 meters. So I wonder, is the "problem" the Agilent ground wire? It could be shorter but it's pretty darn short already and Agilent is clearly happy with it. This is the probe with the grounding clip attached: http://www.home.agilent.com/en/pd-1938439-pn-N2862B/passive-probe-101-150-mhz-12-mAre there better choices? Agilent seems to think this one is $110 worth of probe and they gave me two with the scope.
|
|
|
|
« Last Edit: November 24, 2012, 03:00:05 am by JoeN »
|
Logged
|
|
|
|
|
the land of sun+snow
Offline
Edison Member
Karma: 91
Posts: 2239
|
 |
« Reply #8 on: November 24, 2012, 03:08:46 am » |
Critical thing is the loop at the tip of the probe, not the length of the coax. [time for sleep now].
|
|
|
|
|
Logged
|
Something different - Kitchen-Sink Arduino-compatible boards
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 299
Posts: 26030
Solder is electric glue
|
 |
« Reply #9 on: November 24, 2012, 03:57:57 am » |
The scope probe is vital. You can pay more for a good scope probe than many scopes. Your real wave shape is square, anything else is either an effect of the load or an artefact of the measurement. You learn to see the wave not what is shown on the screen. The bandwidth of the amplifier in the scope also has an effect. You can sample as fast as you like but you won't get over this. In general you will only see a squarish wave when your scope bandwidth is at least ten times the frequency you are looking at.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #10 on: November 24, 2012, 08:08:25 am » |
I did the old standby of banging a square wave from an Arduino Due using digitalWrite If you really want to know your Due's pin flipping capability, google "arm bit banding".
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX
Offline
Faraday Member
Karma: 42
Posts: 5248
CMiYC
|
 |
« Reply #11 on: November 24, 2012, 11:24:21 am » |
but it's a digital scope with a 2GS/s sampling rate. That just tells you how fast the A/D samples. In your case, you are using peak-detect which is throwing samples away. Even though you are significantly oversampling, you should really turn that sampling mode off if you're trying to visualize what the waveform actually looks like. limits the maximum resolution to 70mhz (and they spec different probes for over 100Mhz too) That isn't quite right. The bandwidth of the scope defines the analog bandwidth that gets sampled by the A/D. So this tells you no matter how fast the A/D runs, the fastest signal your scope will accurately measure is 70MHz. The analog bandwidth can also tell you the fastest rise time the scope will be able to reproduce/measure. If your rise time matches the analog bandwidth, that's a good sign your signal contains content faster than your scope can reproduce. As Mark mentioned, this means with a 21MHz signal, you're only seeing the 3rd harmonic. Without the 5th (and maybe 7th) you won't see much of a square wave. Remember that square waves are actually multiple sine waves added together.
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 299
Posts: 26030
Solder is electric glue
|
 |
« Reply #12 on: November 24, 2012, 11:58:11 am » |
Remember that square waves are actually multiple sine waves added together. That applies for any wave shape that is not a sin wave. Edges like you get in square waves have an infinite number of sin wave harmonics making up that vertical edge.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 282
Posts: 15443
Measurement changes behavior
|
 |
« Reply #13 on: November 24, 2012, 12:24:55 pm » |
Remember that square waves are actually multiple sine waves added together. To be more precise a square wave is made up of it's fundamental frequency plus all it's odd harmonics. So your scopes (and it's probe) ability to accurately display the real wave shape of the applied square wave is how many of those harmonics can the measurement instrument system accurately reproduce, which is related to the bandwidth specification of the measurement system. That is why GM stated that a good rule of thumb is that scope (and probe) should be rated at 10X the bandwidth of the frequency to be measured. To put that into perspective that means to accurately display the true wave shape of a 10 Mhz square wave one should be using a measurement system (such as scope plus it's probe) rated to be flat out to 100 Mhz, or better yet higher then that. A scope rated at 10 Mhz will not be able to accurately display a 10 Mhz square wave. So the ARM chip is developing true square waves (perhaps limited only by it's raising and falling transition specs, the tops and bottoms are 'flat' leaving the chip, so any variation (dips and peaks) in the wave shape is an artefact of your measurement system. Lefty
|
|
|
|
« Last Edit: November 24, 2012, 12:59:13 pm by retrolefty »
|
Logged
|
|
|
|
|
the land of sun+snow
Offline
Edison Member
Karma: 91
Posts: 2239
|
 |
« Reply #14 on: November 24, 2012, 12:46:33 pm » |
I'm sure that probe is fine, and not the problem. Those things are made for much higher frequencies than you're using. Just don't add any extra length in hooking up the ground lead. One thing you might try is using an output pin of the DUE that is close to a ground pin on a header. Also, you definitely should try source series terminaton, as I mentioned. The Arduino board female headers are not very ideal for sending out high-frequency signals either. Especially if you're tapping into them using those funny little wire leads with male pins. Totally not optimal.
|
|
|
|
|
Logged
|
Something different - Kitchen-Sink Arduino-compatible boards
|
|
|
|
|