DigitalOut Ringing

05 Mar 2011

I'm seeing up to +/- 2v ringing on the DigitalOut pins. Is this normal?

This code produces the output as shown in the scope plots below:

#include "mbed.h"

DigitalOut myled(LED1);
DigitalOut LINPin(p20);

int main() 
{
    while(1) 
    {
        LINPin  = !LINPin  ;
        wait_us(48);      
    }
}

Scope Plots:

/media/uploads/numerical7/output.jpg

05 Mar 2011

Very interesting, Kevin.

A few questions:

  1. Can you tell us about the hardware environment?
    • Is the mbed sitting in a protoboard?
    • Or your own circuit board?
    • Is it powered from USB?
  2. Is anything else connected to p20?
    • Wires?
    • Components?
  3. Where have you connected the scope ground lead? If you clip it directly to pin 1 of the mbed, do things change at all?
  4. Do you ever see spikes going below ground on the falling edges?
  5. Is there a pattern to how often the spikes on the rising edges occur? Your top photo shows two spikes that are 7 cycles apart - is this a random interval or a repeated one?
  6. Is there a pattern to spike amplitude - that is, if viewed on a much slower time scale what sort of envelope would you see on the tops of the peaks? Random? Sine wave? If there is a pattern, what is its period of repetition?

I can't help wondering if this is somehow related to the odd spikes that show up in ADC results when pin 20 (among others) is used for analog input.

If you have time, perhaps you could configure p20 as an input, leave the scope attached, and see if you capture any disturbances on what should be a quiescent pin.

05 Mar 2011

Hexley Ball wrote:

Very interesting, Kevin.

A few questions:

  1. Can you tell us about the hardware environment?
    • Is the mbed sitting in a protoboard?
    • Or your own circuit board?
    • Is it powered from USB?
  2. Is anything else connected to p20?
    • Wires?
    • Components?
  3. Where have you connected the scope ground lead? If you clip it directly to pin 1 of the mbed, do things change at all?
  4. Do you ever see spikes going below ground on the falling edges?
  5. Is there a pattern to how often the spikes on the rising edges occur? Your top photo shows two spikes that are 7 cycles apart - is this a random interval or a repeated one?
  6. Is there a pattern to spike amplitude - that is, if viewed on a much slower time scale what sort of envelope would you see on the tops of the peaks? Random? Sine wave? If there is a pattern, what is its period of repetition?

I can't help wondering if this is somehow related to the odd spikes that show up in ADC results when pin 20 (among others) is used for analog input.

If you have time, perhaps you could configure p20 as an input, leave the scope attached, and see if you capture any disturbances on what should be a quiescent pin.

  • The mbed is on a breadboard with nothing else attached to it.
  • The mbed is powered from the USB port.
  • I tested it two ways: 1)With nothing connected to PIN20 and 2)With a 10K pulldown resistor from PIN20 to ground. Both ways exhibit the same results.
  • The scope ground is connected directly to PIN1 Ground on in the mbed.
  • I do see spike going negative below 0v. See this: /media/uploads/numerical7/negativegoing.jpg
  • The spikes occur randomly all the time. If you let the scope continuously trigger you see the spikes appear on almost every pulse. Taking a screen capture of the scope does not do justice because it is only showing one sweep in time. If you let the scope go continuous trigger you see the spikes all over.
  • Spike amplitude varies between 1v and 2v. It may be more but my scope is only 50MHz so it may be missing something.
  • I configured the PIN20 as an input and there is no voltage on PIN20
05 Mar 2011

Since this happens on both rising and falling edges, and happens all the time, most likely you are seeing an artifact created by the scope reacting to the extremely sharp edges of the output pulse.

Very sharp edges can make things ring due to inductance in the associated connections; particularly the ground lead of the probe.

I wouldn't worry about it.

But if you want to investigate further, you could remove the ground lead from the probe, remove the probe's hood, then create a "shortest-path" ground lead by wrapping a short length of bare wire around the metal ground band at the tip of the probe, then connecting the end of that wire to a ground right next to the signal being measured (like the grounded side of LED1 on the mbed). Something like this:

http://www.cliftonlaboratories.com/userimages/Update203.jpg

I've used this technique many times, and it always gives a very clean signal. Kind of a pain to set up sometimes, but worth it if you suspect scope artifacts are a problem...