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.
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.
How did you probe the signal from the arduino? Show/describe your setup.
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.
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.
Thank you very much! This was the problem. With the nointerupts(), the waveform is perfectly stable!
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.
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.
jrmelectronics (trying to demonstrate another thing) showed an acceptable squarewave with no over/undershoot even with >25KHz and a simple digitalwrite HIGH/LOW
Why don't you just use the built in timers and an interrupt to do this? Much faster and more deterministic.
BR
Why don't you just use the built in timers and an interrupt to do this? Much faster and more deterministic.
Interrupts are deterministic?
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.
I understand how software latency causes the horizontal over/under shoots, but what caused the vertical over/undershoots?
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.
I understand how software latency causes the horizontal over/under shoots, but what caused the vertical over/undershoots?
Impedance mismatch is one of the possible reasons. Your source impedance is probably a lot different than the input impedance at your scope.
Why don't you just use the built in timers and an interrupt to do this? Much faster and more deterministic.
Interrupts are deterministic?
If designed and implemented correctly within the confines of the system, then yes, interrupts are 100% deterministic. In this case, output compare can be used.
what caused the vertical over/undershoots?
Most likely: Connecting the probe to long breadboard wires poked into the Arduino edge connector.
(ie. Inductance)