Hi Speed ISP over a Cat5 cable

Latest update: click to Go!

This experiment was initiated by fellow-freak Miamicanes needing to do ISP-programming over a 30'(30 feet, so appr. 10 meter) Cat5 cable.
On my webpage http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html I explained the ringing phenomenon.
With 10m Cat5 that ringing will be even worse.


I made a small test setup to have a closer look at this problem
< added info for Jani -  17 sep 09   -   you will need to refresh this page in your browser, Jani, to get the new picture >





The small program:

'**************** Freeduino as TestRig for HiSpeed ISP over Cat5 cable of 15 meter ************************


'The START .....

$baud = 38400 'for debug only
$crystal = 16000000
$regfile = "m168def.dat"

$hwstack = 40 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space



'Timer1 setup Mode 8 Phase and freq correct pwm, ICR1=top

Tccr1a = &B10000000
Tccr1b = &B00010001

Set Ddrb.1 'enable output of OC1A
Capture1 = 7
Ocr1a = 1


Do
Loop


The schematic it looks like this:








Picture 1:  Ch1 shows OC1A from the AVR
R1 and R2 are in place, C1=0pF

Ch2: measured over R2. The pulse amplitude is about 2V, so barely enough to meet the spec of TTL or HCT


Nothing changed, except that Ch1 now measures what is at the beginning of the cable
Oooompf

R2 is removed, so we lack termination. The pulse at the end of the cable travels back to the source, and that's the second pulse on Ch1
Nasty huh ?

Oh, BTW: using a narrow pulse is TEH way to go for these experiments.
O my goodness:

The transmission line (the cable) is driven HARD .... and no termination by R2

How is that for a digital signal ?!
But look what happens if the line is terminated with 100 Ohm !
And now as a bonus experiment: R1=22 Ohm, a small capacitor of 220pF reduces the slewrate, R2 in place as terminator ( I'll be back - AS)





We're going for a dynamic load: a resistor with a capacitor in series.
Goal: proper termination for the HF-component of the signal and no load for DC.




To get a good insight, I sticked with the narrow pulse.
Btw, narrow is a relative term of course. In terms of ISP it's narrow  ;-)
But since ISP takes place at a lower frequency I added tests with 160 kHz, 50% dutycycle.
The 10 nF looked nicer, but the smaller the capacitor, the less we have to worry on the load it represents to the programmer and target-AVR (Miso-line that is)
Clean shit huh ?
Using 1 nF : it will still work fine for ISP but it's a bit too small IMO
..... and the overshoots on the output, and the initial load for the source (programmer or target AVR)


A few notes:
1. Where I talk about ISP you can also think of JTAG: doing that over 10 meters, that is fun !
2. The terminator-resistor (termisistor ?): 150 Ohm is as high as I could go without spoiling the waveform. As for the capacitor: the smaller the better, for the resistor the higher the better. Doing so, the network will have less influence on programmer and target AVR


Oh, and for the sake of completeness: the program

'**************** Freeduino as TestRig for HiSpeed ISP over Cat5 cable of 15 meter ************************


'The START .....

$baud = 38400 'for debug only
$crystal = 16000000
$regfile = "m168def.dat"

$hwstack = 40 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space

Dim Top As Word
Dim Pulse_width As Word


'Timer1 setup Mode 8 Phase and freq correct pwm, ICR1=top

Tccr1a = &B10000000
Tccr1b = &B00010001

Set Ddrb.1 'enable output of OC1A

'Default values
Capture1 = 7
Ocr1a = 1


Do

Print "New settings ..."
Input "Top = " , Top
Input "Pulse_width = " , Pulse_width
Capture1 = Top
Ocr1a = Pulse_width


Loop


One final step: the schematic for miamicanes project.

Coming ....




Just for a comfortable feeling: I tested also with several different type / length of cables
Termisistor= 150 Ohm with 2n2 in series

As could be expected: no problemo !
A bit more rounded off
Hmmm, this shows the mismatch:
Mark the yellow signal
Now terminated with
Termisistor= 100 Ohm with 2n2 in series

O crap, just found out that on the incoming side the 22 Ohm resistor was still in place but luckily only for these last 4 experiments
I am too lazy to do it all over again.  Instead I just checked the last situation: a bit larger amplitude for the Gigabit Cat5 and it shows that 100 Ohm as termisistor is better than the 150 Ohm.

Knowing what we learned so far:

If the AVR-pins on the target AVR are not used for the application, or are semi-static (for status-led or so), it's feasible to do ISP-programming over 10 meter, and I dare to say 20 meter Cat5 cable, with just passive components. If the SPI-pins are used i by the target AVR, the Active Pods are recommended. They isolate the cable from the target AVR.
The first schematic < wow, there were "some" errors in it --- deleted >

UPDATE Sep 19, 23.30u GMT + 1 (= Amsterdam)

Sheet 1 of 3 shows a passive pod setup; see notes in the schematic.
As usual: right click the image, choose "Save As" to store it in full size, or
right click the image, choose "View picture".
The ExpressSch file (zipped) in case you wish to have the source of the schematic. Go to my Tools-page to find out where to download the ExpressSch software.



Note that it uses the same pinout as a straight Ethernet cable: that may come in handy when the home-cable-infrastructure is used for something else. Like upgrading to Giga Ethernet :-)
I hope that miamicanes has a 1000 feet of 24 AWG Cat5 cable.

Sheet 2 of 3 shows two versions of the Active Pod Programmer side: the upper for beefy ISP-programmers, the lower for the weaker brothers, like a bare (or un-laired) Dragon



Sheet 3 of 3 shows the Active Pod at the Target side: as noted in the schematic, the ISP connector can be replaced with the actual target AVR. But make sure you provide a proper reset circuit for the AVR /Reset line. (No, it's not in this schematic)



I think the job is done. If you spot a problem, don't hesitate to post it in the thread http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=83985

Kudos to:
Kasper, (KKP), for his inspiring ideas and this document http://n1.taur.dk/permanent/dragonhide.pdf 

Jani, (Jepael) for the idea of AC-termination, corrupted by me to Terministor ;-)
and miamicanes for bringing up the interesting problem of ISP-ing over 30' ..... for Europeans: 30 feet is about 10 meters.

And a bit of kudos to myself of course: I dropped my current project to sort this out. It was a pleasure though    :-)
Tada !

Nard
alias Plons