Author Topic: Oscilloscope's probe makes my device work. But why!?  (Read 7691 times)

0 Members and 1 Guest are viewing this topic.

Offline iwaszTopic starter

  • Contributor
  • Posts: 17
Oscilloscope's probe makes my device work. But why!?
« on: November 03, 2013, 03:23:52 am »
Hi all!

   This is my first post here, so hello everyone. I am puzzled about one stupid issue I have with my custom STM32F4 board which I recently designed. I am able to program it (SWD) only when... oscilloscope probe is attached to the SWDCLK pin. Probe itself can be attached to the scope, or not, does not matter. Grounding of the probe is also left floating in the air, or may be connected, as you wish. I suspect, that since I am a total beginner, I miss some fundamental theory like, dunno, capacitance of wires connecting ST-Link and my board, or some noise issues, or I don't know what. Little details:

* Command used to upload flash is : st-flash write i2c-test.bin 0x8000000 (Linux).
* Board used as a ST-Link : http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF250863
* µC used on my board : STM32F407VET6
* SWDIO connected directly to PA13 and SWDCLK connected to PA14.

Should I post the schematic and/or PCB layout?
Regs.

PS. I thought that oscilloscope probes are designed so they introduce little/no noise into the circuit. I.e. they not interfere with circuit being measured. So why this has happened?
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #1 on: November 03, 2013, 03:49:05 am »
assuming it isn't a mechanical problem, how long is your SWCLK line? What does it run near?

PS oscilloscopes aren't magic  ^-^
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #2 on: November 03, 2013, 04:00:31 am »
assuming it isn't a mechanical problem, how long is your SWCLK line? What does it run near?

PS oscilloscopes aren't magic  ^-^

I agree with Jeremy.  It's probably something to do with the long length of the SWDCLK line.  I had a past situation before with the ST-LINK , I had a fairly long SWDCLK line and it was garbage by the time it reached the board that I was trying to program.  I ended up putting a 22 ohm resistor in series with the SWDCLK line on the board itself, at the connector, to terminate the long line from the STLINK.  This made the clock better and I was able to program it.
 

Offline iwaszTopic starter

  • Contributor
  • Posts: 17
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #3 on: November 03, 2013, 08:55:42 pm »
Thanks guys.

    I soldered 22R resistors in series with SWDCLK and SWDIO (as close to the µC pins as I could). On the STM32F4-Discovery board they are also present, so I assume this is some common technique? But this helped only a little bit. Now I can program without probe attached only sometimes (but this is an improvement all in all). SWDIO and SWDCLK cables are approx. 20cm long (8 inches). SWDCLK trace is approx 2cm long, and SWDIO is 3cm (could it be the issue? The difference between trace lengths?). Both traces go under two quartz resonators (4MHz and 32kHz) and µC itself. Both traces have one via each (from bottom to top layer).
 

Offline Stonent

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #4 on: November 03, 2013, 09:04:03 pm »
There was a post in another part of the forum not too long ago about some ST devices that showed on the datasheet resistors on the clock lines.
The larger the government, the smaller the citizen.
 

Offline iwaszTopic starter

  • Contributor
  • Posts: 17
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #5 on: November 04, 2013, 01:01:09 pm »
PS oscilloscopes aren't magic  ^-^

Quick update : I've found a book entitled "High Speed Digital Design: A Handbook of Black Magic". It has following chapter "How probes load down a circuit". Excerpt : "The act of using a probe changes the behavior of the circuit under test. Surely, we have all encountered circuits that work when we are probing them but malfunction as soon as we withdraw the probe. This is a common occurrence, due simply ...". I gues it is worth reading, must give it a try... regs.
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37738
  • Country: au
    • EEVblog
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #6 on: November 04, 2013, 01:27:50 pm »
PS. I thought that oscilloscope probes are designed so they introduce little/no noise into the circuit. I.e. they not interfere with circuit being measured. So why this has happened?

Capacitance.

Look at the datasheet for your x10 probe, it will have maybe 10-15pF of input capacitance.
Use the standard formula to find the impedance of that cap at your frequency of interest.
e.g. 10pF is 159ohms at 100MHz
That loads down your circuit a lot...

 

Offline w2aew

  • Super Contributor
  • ***
  • Posts: 1780
  • Country: us
  • I usTa cuDnt speL enjinere, noW I aR wuN
    • My YouTube Channel
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #7 on: November 04, 2013, 02:32:19 pm »
PS. I thought that oscilloscope probes are designed so they introduce little/no noise into the circuit. I.e. they not interfere with circuit being measured. So why this has happened?

Capacitance.

Look at the datasheet for your x10 probe, it will have maybe 10-15pF of input capacitance.
Use the standard formula to find the impedance of that cap at your frequency of interest.
e.g. 10pF is 159ohms at 100MHz
That loads down your circuit a lot...

And, if you have a switchable 1X/10X probe, and it's in the 1X position, then the loading capacitance can be 100pF or more!
YouTube channel: https://www.youtube.com/w2aew
FAE for Tektronix
Technical Coordinator for the ARRL Northern NJ Section
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4228
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #8 on: November 04, 2013, 02:38:11 pm »
To diagnose this problem we really need to see the physical layout of your design, including the wiring and the device you're using to drive the SWD interface. It's almost certainly a signal integrity problem which can be cured by using shorter wires, terminating the SWD lines properly, and/or adding a small amount of capacitance in just the right place.

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1352
  • Country: si
  • I like to measure things.
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #9 on: November 04, 2013, 05:43:17 pm »
I have faced this problem when I was working on a circuit at my summer job, except we used SWIM for programming. I hooked up the oscilloscope to see what's going on on the communication lines and everything started working again.
A quick and dirty solution was to put a small cap on the reset line (22 puff, IIRC). We then temporarily solved the problem by replacing the excessively long programming cable with a short one.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline iwaszTopic starter

  • Contributor
  • Posts: 17
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #10 on: November 04, 2013, 11:28:16 pm »
To diagnose this problem we really need to see the physical layout of your design, including the wiring and the device you're using to drive the SWD interface. It's almost certainly a signal integrity problem which can be cured by using shorter wires, terminating the SWD lines properly, and/or adding a small amount of capacitance in just the right place.

Thanks guys!

   It's great you all responded! Here below I attached the layout. As you can see, SWDCLK trace is nearly 2 times shorter than SWDIO. When I extended SDWCLK wire (I mean the wire which connects ST-Link with my board) it all of a sudden started to work as it should be. So I guess this is something with signal propagation? But this SWDCLK signal measured with an oscilloscope seems to be only 1.25 MHz, so it is not so fast to introduce those fancy fast signal issues described in those wise books I've found? Or is those 1.25 MHz really that fast (or is it those rise time, and F-knee frequencies)? It is a little bit frustrating you know. Acquiring all this knowledge about ARM Cortices (STM32 in particular) was daunting and when I finally thought I understood the bits and bolts of I²C, USART and USB communications (and I was able to program my dev-board with success - I am a programmer after all) it revealed that there is more than that. There is bunch of physical phenomena which stops me from achieving the goal! It's a little off topic I know, but I had no one to cry out to :D Cheers.

 

Offline iwaszTopic starter

  • Contributor
  • Posts: 17
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #11 on: November 04, 2013, 11:35:48 pm »
PS. Those are my probes (I think) : https://www.mortoncontrols.com/index.php?main_page=product_info&cPath=66_71&products_id=551

So when set to 10X, they should have 13pF~17pF capacitance right?
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37738
  • Country: au
    • EEVblog
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #12 on: November 05, 2013, 12:10:43 am »
So when set to 10X, they should have 13pF~17pF capacitance right?

Correct.
Impedance = 1 / (2 * PI * FREQ * C)
 

Offline JoeyP

  • Frequent Contributor
  • **
  • Posts: 321
  • Country: us
Re: Oscilloscope's probe makes my device work. But why!?
« Reply #13 on: November 05, 2013, 02:33:49 am »
Or is those 1.25 MHz really that fast (or is it those rise time, and F-knee frequencies)?

1.25MHz isn't considered fast at all, but the edge times might be. Modern logic typically has edge times of around 1nS or less. That can easily cause ringing on an improperly terminated transmission line, and if the amplitude of that ringing is great enough, your chip will see it as extra clock cycles which is what screws up your programming.

Adding the parallel capacitance of your scope probe along with the series inductance of the leads/traces driving your chip creates an LC low pass filter which reduces the amplitude of the ringing enough that the chip doesn't detect it as extra clock cycles.

Adding a series resistor, combined with the input capacitance of your chip does the same thing except it's an RC low pass filter. It also has the benefit of improving the termination of the line, which will reduce the reflections/ringing. 22 ohms isn't much. For a 1.25MHz clock you can probably get away with much more. Something in the neighborhood of 50-100 ohms would be reasonable.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf