Oscilloscope's probe makes my device work. But why!? - Page 1
Forum section: electronics / beginners

author: iwasz
author_rank: Contributor
timestamp: November 03, 2013, 03:23:52 am
content: 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?

author: jeremy
author_rank: Super Contributor
timestamp: November 03, 2013, 03:49:05 am
content: assuming it isn't a mechanical problem, how long is your SWCLK line? What does it run near?PS oscilloscopes aren't magic

author: codeboy2k
author_rank: Super Contributor
timestamp: November 03, 2013, 04:00:31 am
content: Quote from: jeremy on November 03, 2013, 03:49:05 amI 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.

author: iwasz
author_rank: Contributor
timestamp: November 03, 2013, 08:55:42 pm
content: 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).

author: Stonent
author_rank: Super Contributor
timestamp: November 03, 2013, 09:04:03 pm
content: 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.

author: iwasz
author_rank: Contributor
timestamp: November 04, 2013, 01:01:09 pm
content: Quote from: jeremy on November 03, 2013, 03:49:05 amQuick 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.

author: EEVblog
author_rank: Unknown
timestamp: November 04, 2013, 01:27:50 pm
content: Quote from: iwasz on November 03, 2013, 03:23:52 amCapacitance.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 100MHzThat loads down your circuit a lot...

author: w2aew
author_rank: Super Contributor
timestamp: November 04, 2013, 02:32:19 pm
content: Quote from: EEVblog on November 04, 2013, 01:27:50 pmAnd, if you have a switchable 1X/10X probe, and it's in the 1X position, then the loading capacitance can be 100pF or more!

author: AndyC_772
author_rank: Super Contributor
timestamp: November 04, 2013, 02:38:11 pm
content: 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.

author: Dave
author_rank: Super Contributor
timestamp: November 04, 2013, 05:43:17 pm
content: 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.

author: iwasz
author_rank: Contributor
timestamp: November 04, 2013, 11:28:16 pm
content: Quote from: AndyC_772 on November 04, 2013, 02:38:11 pmThanks 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 toCheers.

author: iwasz
author_rank: Contributor
timestamp: November 04, 2013, 11:35:48 pm
content: PS. Those are my probes (I think) :https://www.mortoncontrols.com/index.php?main_page=product_info&cPath=66_71&products_id=551So when set to 10X, they should have 13pF~17pF capacitance right?

author: EEVblog
author_rank: Unknown
timestamp: November 05, 2013, 12:10:43 am
content: Quote from: iwasz on November 04, 2013, 11:35:48 pmCorrect.Impedance = 1 / (2 * PI * FREQ * C)

author: JoeyP
author_rank: Frequent Contributor
timestamp: November 05, 2013, 02:33:49 am
content: Quote from: iwasz on November 04, 2013, 11:28:16 pm1.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.