# Why SD libraries fail with resistor voltage dividers

This is not true. We are not dealing with a transmission line. This is a totally different problem.

We are dealing with a divider where one impedance is a 2 k resistor and the second is a 50 ohm resistor in parallel with about 150 pf of cable and scope capacitance.

The discussed "probe" divider consists of: 2k resistor with an impedance of 2000 + j0 (it is the probe tip as well as it is a part of the sdcard's divider) and 50ohm resistive impedance (50+j0) "as seen at the input side" of the transmission line (represented by the 1m long 50ohm coax) terminated (at its output) by the 50ohm termination resistor (50+j0).

There is no capacitor involved, I would say (not considering small reactancies of capacitive parasitics and inductive parasitic reactancies of any wires involved).

ScopeModel.png Assumes cable and scope capacitance is 150 pf and input is to a 50 ohm terminator.

The properly terminated coaxial cable (or other transmission lines properly terminated) does not behave as two wires with two capacitors at the near and far ends wired.

The equivalent model of a transmission line is complex and distributed, afaik it includes N capacitors, 2N inductors, X resistors and other parameters probably. So in order to simulate the stuff properly you need a model for the coax there.

The square wave turns into this because of the cable and scope capacitance.

The coax is a transmission line (when terminated properly) which cannot be considered similar to the Layden jar.

Your scope has got a channel A (my assumption) with a BNC connector on the front panel. Near the connector there is (most probably) an information depicted: 1M || 25pF (or 50pF). That says: "Dear user of our o'scope, this channel A input has an complex impedance equivalent to 1megaohm resistor with parallel capacity of 25pF (or 50pf) wired from inside at this BNC connector. The internal circuitry of the channel A (voltage dividers, amplifiers, etc.) has been compensated for that input complex impedance thus the AC response of the channel A is flat within guaranteed bandwidth."

It means you must not consider that capacitance for your simulation, nor for your design (it is compensated by the o'scope itself). The 1Meg internal resistance in parallel with 50ohm (the 50ohm BNC terminator plugged into the channel A BNC connector from outside) does not play any role too.. The termination impedance is considered (and designed) resistive only (50 + j0).

So it is my current understanding that you must not include the input capacitance of the o'scope into any simulation. The stray capacitance at both ends of the coax might be something like 1pF max. The parasitic parallel capacity of the lower resistor (probe tip) would be 0.5pF max with small axial resistor or less with SMD one.

The resistors (and capacitors and wires) have serial inductive reactance as well, let us assume we will neglect it for today. The coax parameters (like pF/m, uH/m, ohm/m..) must not be consider for the simulation too, as all that stuff is already included int the statement "it is the 50ohm coax cable with following model parameters", when properly terminated.

I played with this test on my scope and get the same result though noisy since the signal is only about 80 mv.

Try it based on my schematics above with the coax (terminated by 50ohm BNC terminator at the o'scope input). Your results will be much nicer.. Of course you have to cut the coax and solder a BNC connector, maybe you want to avoid that :)

Probing High-Speed Digital Designs by Dr. Howard Johnson. First publ. in Electronic Design, March, 1997:

A report on the suggested "probe" in my above schematics for your divider problem measurement setup - see the "Figure 3—Resistive-Input Style Probe (Z0 Probe)"

Your probe will be the "2k" tip probe, usually "1k" tip is used by experts, but it does not matter for your purposes, moreover the 2k fits your sdcard's divider problem as explained above:

https://www.sigcon.com/Pubs/straight/probes.htm

On the last page there is a detailed guide for you: "How to Make A 1K-Ohm Probe". They recommend RG-174 for 1GHz bandwidth (but you may go with RG58 as well, the 174 is thinner). You will use 2k instead 1k as it is the part of your sdcard divider. See the details on parasitics.

BTW, the suggested probe in my above schematics has been rated extremely well in comparison with a passive 10:1 probe and an 1pF FET active probe:

"..The resistive-input probe is cheap, it has a terrific bandwidth, and it is more tolerant of long ground wires than the other probes.. ..In high-speed system developments, the ubiquitous 10-pF 10:1 capacitive-input probe is no longer adequate. The two alternatives are the FET-input probe and the resistive-input probe. Of the two, the resistive-input probe is cheaper, it has as good or better bandwidth, and it is more tolerant of long ground wires. These advantages come at the cost of higher IOH required in your digital circuits in order to drive the 1K resistor. In modern high-speed systems, because the extra drive current is almost always readily available, the resistive-input probe makes a lot of sense. As we go higher in frequency, the FET-input probes will run into increasing difficulties. At signaling rates faster than about 300-pS rise-fall, only a resistive-input style probe can maintain a high enough input impedance to remain useful."

;)

PS: another reading for you - a comparison of the suggested "probe" with 7 GHz Agilent Infiniimax \$10k probe (while measuring a 100ps fast rising edge): http://koti.kapsi.fi/jahonen/Electronics/DIY%201k%20probe/

pito,

You are right I tried it again. I had a bad ground wire in the setup with the 50 Ohm terminator. Now I know why it was so noisy.

The 50 ohm cable into the 50 ohm terminator must be resistive.

It's not that the cable doesn't act as a capacitor at low frequency, it does. But it also has inductance so at 8 MHz it is just a chunk of the lumped transmission model.

Without the 50 ohm terminator it looks like a capacitor and that's why 1M scopes need the compensating cap in their probes.

The 0.075?H per foot is too small to matter in the low frequency 1 M ohm case.

Sorry, I have calculated the impedance of coax in E&M classes but I was thinking about use of the cable at low frequencies in high impedance probes.

I am tired of this. We are not dealing with high frequencies. At 8 MHz the meter of coax acts as a cap.

I do understand your concerns. This is a small and boring engineering problem you deal with. Nothing so sexy as gamma rays bursts, or QED. But easier to understand..

The cable is full of frequencies when measuring your SPI clock. 8MHz is only the fundamental frequency. Then you have there a lot of much higher frequencies related to the SPI clock edges.

The trick with filling in the waves into the coax is following: when you want to observe the clock edges, you have to see the contribution of almost unlimited number of harmonics of the 8MHz. When you watch only 8MHz frq you will see a sinus.

In order to see the edges of the signal - this is what you want - you must add all the higher frequencies to the picture - the more higher frequencies there the better picture - the sharper the picture.

If you want to see for example 10ns rising and falling edges (probably the max with atmega SPI) and how they are distorted, you must involve all frequencies up to 300MHz. The frequencies are there - this is not just a thought experiment.

The steeper the edges, the more frequencies are there. Atmega produces frequencies up to hundreds of megahertz (because of its 10ns edges).

All this mess travels through your coax. Therefore, if you want to see a nice picture, with all details, you must care on a broadbanded measurement chain.

You may have 1 kHz SPI clocking, but when you want see its edges properly and undistorted,, you need to mess with 200-300MHz spectrum.

Some time back there was an interesting discussion in this forum (I think started by crossroads) on what parameters an o'scope has to have when considering its purchase. I contributed with a post saying that everything below 200MHz bandwidth to purchase today is wasting the money. People discussed why to mess with 200MHz when arduino is about 16MHz. I think crossroads purchased a 200MHz one at the end. Now he smiles as he can observe the edges of an 1kHz SPI clock in nice details :) I've been waiting till the 63GHz o'scope price drops by 99.95%..

I totally changed my previous post just a few minutes before your last post to say you are right.

It finally dawned that the scope probe compensation formula is only valid for high impedance scope inputs where the coax impedance is much less than the 1M of the scope. This is where the cable looks like a cap.

Another experiments with the "probe" with meas. results: http://forum.43oh.com/topic/770-diy-high-speed-201-scope-probe/ http://www.eetimes.com/document.asp?doc_id=1272404 http://www.eevblog.com/forum/projects/cheap-wideband-121-oscilloscope-probe-for-logic-signal-applications/

People discussed why to mess with 200MHz when arduino is about 16MHz. I think crossroads purchased a 200MHz one at the end.

pito,
I agree, 200 MHz is needed. Many 200 MHz scopes do 1 GS/s, If possible get a 2 GS/s.

I have a Tek which does 2 GS/s and I can see the rise time of 8 MHz SPI. See the attached trace. This works since the signal is low impedance.

The trace is the first SCK pulse of a SPI transfer. I was doing one transfer every millisecond so the scope has an 8 kHz pulse frequency.

Too bad active probes are so expensive. Passive 10X probes just can’t look at higher impedance stuff like the divider problem that started this post. I was looking at a first version of an Adafruit shield and would not have been able to use your method since the divider was soldered to ground.

Nice! It seems your rise time is something like 3ns. How did you measure that? With the tek 1:10 or with the "2k probe"? I would be happy to see how the 2k probe performs in your setup (with sdcard connected). Attention: when you disconnect the 50ohm termination at the o'scope input from the coax the sdcard gets full 5V with the measurement setup I suggested..

That was with the "2k probe" after I got it right. It is just pin 13 of the Arduino with nothing else.

I will try to setup an SD with a resistor voltage divider and see if I can measure it.

I was looking at a first version of an Adafruit shield and would not have been able to use your method since the divider was soldered to ground.

I would simply desolder the smd divider resistor, connect the gnd of the coax to gnd pad and the central wire of the coax via the desoldered resistor to the S point. The only risk is you may damage the gnd or S point pcb pad while you will mess with the coax somehow…
Attention: when you disconnect the 50ohm termination at the o’scope input from the coax the sdcard gets full 5V with the measurement setup I suggested (as the 50ohm termination is a part of the low side sdcard’s divider resistor) !
]

This is my estimation based on the 3ns rising edges measured wih 2k probe (no divider) and what could be expected with with and without sdcard inserted. Interested to see how it fits the measurement.
Note: An assumption is made here:

1. sdcard’s socket (and wires) stray capacitance is 5pF
2. sdcard’s input capacitance is 10pF

pito,

I searched my old junk boxes and found the Adafruit shield from 2008.

I can't believe the circuit. The dividers on SCK and MOSI have 10k/4.7k resistors.

Chip select has two resistors and a 3.6 V Zener diode.

Now I understand why I worked so hard to convince Limor Fried to redesign it.

Limor sent me some pcbs to play with and I replaced the the six resistors and Zener diode with a 74HC4050N.

That made it reliable and Limor used a 74AHC125N in the modified board.

I guess I will run the test on the board but we know it will be horrible.

I can’t believe the circuit. The dividers on SCK and MOSI have 10k/4.7k resistors.

UPDATED:
You might see this probably (w/ sdcard inserted):

The peak value shall be something like 17mV with “10kprobe”, but the R1C2 is so big the signal has not enough time to rise to that level @8MHz clock.
PS: The yellow is the “ideal” signal at the sdcard input (as seen with “10kprobe”) - so you may observe the killing effect better.

The divider has the 10k to GND.

Here it is. I set the multiplier to 100X but it is really close to 200X. 50 ohms and 10k. I didn’t fool with a fine adjustment of the scope multiplier.

So multiply by 2 and it gets close to 3V above base. It actually worked a little with really old SD cards. It was really unreliable.

Well it was worth it to see a picture after all these years.

I think you have the 10k/4.7k swapped. Your shape is close.

I think you have the 10k/4.7k swapped. Your shape is close.

Thanks, fixed, updated above. The shape is close, indeed :) PS: what is interesting to see are the peaks/glitches in both my and your picture about 10ns after falling/rising edges - those are reflections from the coax most probably (propagation delay with 1m long RG58 is aprox 5.2ns). "10k probe tip" is too far away from 50ohm near end coax impedance.. Yours are bigger as you are working with an real cable (and your parasitics around 10k tip are bigger, so the 10k tip resistor is less resistive).. Nice!

Well this changed my view of an Oscilloscope. I have so much prejudice from watching techs use low end scopes that I missed your point of using a cheap scope with a 50 ohm terminator. My view was that this class scope with the 10X standard probe is useful to see wiggles at best above one or two MHz.

Amazing that I could not get the model of a probe being a big low quality cap in the cable and a little cap and resistor at the end. Thanks for hanging in there.

I started cabling physics lab equipment with BNC 50 ohm cables in the 1960s. I spent much of my career in Berkeley where BNC was invented (Berkeley Nucleonics Corporation, 1963). I should have immediately understood you.

The coax reflections are interesting. Last night I started to think that the impedance is not really matched and there should be reflections.

I have been thinking about buying a new scope. I didn't want to buy a scope with the standard passive probes because they can never work well for this kind of problem. This convinces me that with the right effort you can get decent results.

I realized last night that most of the endless forum topics about choosing a scope don't deal with the correct issues.

Looks like I might need to up my budget to be happy. I can afford it but I am a cheapskate until I understand what I am getting.

The reflections come from the parasitic capacitive reactance around the 10k probe tip resistor. Even 0.5pF is causing a reflection in my simulation (I am using a model of RG58U), your parasitics - based on your setup - could be higher, therefore the peeks are higher. Also 10k is "too much" for the ideal tip resistor of this kind of probe as we move far away from the 50ohm near end coax impedance, so any small inductive/capacitive reactance parasitics will cause a near end mismatch.

The 1:10 probes are good for messing with tube audio amplifiers :)

Measuring 3n-10ns edges require 300-900MHz probe bandwidth. There is no such passive 1:10 probe below \$xxxx available, I think. So we have to find a workaround.. :)

BTW all passive 1:10 probes are using a "special coaxial cable" today, where the internal central wire is made of 100-200ohm/m resistive alloy (the RG58 central wire is 0.03ohm/m). That was invented at Tek I think in 196x, because the guys had big problems with reflections and AC characteristic peaking.. :P

I shortened and loosely twisted the wires from the coax to the resistor end/ground pad and the 10 ns reflection can be a bit closer to your model.

BTW all passive 1:10 probes are using a "special coaxial cable" today, where the internal central wire is made of 100-200ohm/m resistive alloy. That was invented at Tek I think in 196x, because the guys had big problems with reflections and AC characteristic peakings..

Interesting, so it looks like the end of passive probe improvement happened long ago.

Char impedance of a twisted wire is usually 90-120ohm, so shortening the wires is the best solution :)

I then watched the scope and moved the wires near the pcb more than twisted them to minimize the glitches.

I would not trash such SDcard shields however. What is important here is you have got a PCB with pads at least
You may replace the 6 resistors with smaller ones easily.

Let us assume we want keep output current within atmega’s PIN output limits, and we want to allow 30pF capacitive load at the divider (worst case scenario).

Below you may see the 200ohm/410ohm divider, with acceptable shape @8MHz and 30pF load, and, you may see the current flowing from the atmega’s output into the divider. Mind there are peaks in the current as you have to charge/discharge the capacitive loads (sdcard’s input and parasitics) and they must stay within the PIN current limits as well.

So values of divider’s resistors (very) close to these values will work fine with all cards, I bet.
(for example from E24 values: R1/R2 200/390 220/390 220/430 )

PS: the lower side of the divider is 410 = 360 + 50 ohm.