new ds1054z, noise square wave arduino - Page 1
Forum section: electronics / testgear

author: freebil
author_rank: Regular Contributor
timestamp: August 19, 2016, 04:13:46 pm
content: Hello. I am new owner of ds1054z. I would like to ask if this is shown in the video is normal.The square waveform was generated from arduino. Contrary to this, the square waveform from the inbuilt generator is perfectly fine.

author: Aodhan145
author_rank: Frequent Contributor
timestamp: August 19, 2016, 04:24:46 pm
content: You might just not be triggered correctly. I don't own one so I'm not the best to guide you on how to do so.

author: mcinque
author_rank: Unknown
timestamp: August 19, 2016, 04:58:26 pm
content: How did you probe the signal from the arduino? Show/describe your setup.

author: freebil
author_rank: Regular Contributor
timestamp: August 19, 2016, 05:12:41 pm
content: I connect the probe to the pin3 and the aligator to the gnd of the arduino. I saw that for 5kHz is way more stable and for 500Hz is absolutelly stable.

author: Fungus
author_rank: Super Contributor
timestamp: August 19, 2016, 05:15:13 pm
content: How are you generating that wave?From the timebase (5uS) it looks like you're doing something like this:void loop(){digitalWrite(pin,HIGH);digitalWrite(pin,LOW);}If so then yes, it's normal. You're seeing software timing artifacts and/or processor interrupts.Edit: Try putting "noInterrupts()" in the setup(), see what happens.

author: freebil
author_rank: Regular Contributor
timestamp: August 19, 2016, 05:49:55 pm
content: Thank you very much! This was the problem. With the nointerupts(), the waveform is perfectly stable!

author: cncjerry
author_rank: Unknown
timestamp: August 19, 2016, 06:25:10 pm
content: Depends on how you are triggering because the loop causes an unbalanced square wave. After the low write the code branches which means the low will be longer than the high. You would have to look at the no op instruction length vs the branch to see if putting one after the write high would balance the square wave. Since your square wave isn't a perfect 50 percent duty cycle your trigger could be causing the artifacts.

author: crazyguy
author_rank: Regular Contributor
timestamp: August 19, 2016, 06:56:30 pm
content: there are 3 hardware timers on the 328 chip, you may make use of them to generate square wave, rather than software looping the I/O pins high and low.

author: mcinque
author_rank: Unknown
timestamp: August 19, 2016, 07:01:07 pm
content: jrmelectronics (trying to demonstrate another thing) showed an acceptable squarewave with no over/undershoot even with >25KHz and a simple digitalwrite HIGH/LOW

author: 1design
author_rank: Regular Contributor
timestamp: August 19, 2016, 07:27:16 pm
content: Why don't you just use the built in timers and an interrupt to do this? Much faster and more deterministic.BR

author: Fungus
author_rank: Super Contributor
timestamp: August 20, 2016, 02:34:18 am
content: Quote from: 1design on August 19, 2016, 07:27:16 pmInterrupts are deterministic?

author: heatbreak
author_rank: Contributor
timestamp: August 20, 2016, 02:51:55 am
content: Quote from: cncjerry on August 19, 2016, 06:25:10 pmI understand how software latency causes the horizontal over/under shoots, but what caused the vertical over/undershoots?

author: Muxr
author_rank: Super Contributor
timestamp: August 20, 2016, 03:08:34 am
content: Quote from: heatbreak on August 20, 2016, 02:51:55 amImpedance mismatch is one of the possible reasons. Your source impedance is probably a lot different than the input impedance at your scope.

author: heatbreak
author_rank: Contributor
timestamp: August 20, 2016, 03:32:41 am
content: Quote from: Fungus on August 20, 2016, 02:34:18 amIf designed and implemented correctly within the confines of the system, then yes, interrupts are 100% deterministic. In this case, output compare can be used.

author: Fungus
author_rank: Super Contributor
timestamp: August 20, 2016, 10:03:32 am
content: Quote from: heatbreak on August 20, 2016, 02:51:55 amMost likely: Connecting the probe to long breadboard wires poked into the Arduino edge connector.(ie. Inductance)