Looking at the end of a long cable on a LPT programmer

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Freaks,

It's well-known that the problems with having a long cable on those cheap LPT programmers are due to the ringing on the SCK line, leading the AVR to see more clocks that is intended. The long cable acts as a transmission line on the fast raise and fall times of the LPT port signals.

As a learning hands-on exercise I wanted to see the ringing, so I changed my programming software to do continuous square wave on the SCK pin and put my scope on the AVR end of a 60cm cable. This square wave has a frequency a bit higher that my normal programming frequency.
However, the ringing I see is just too small in amplitude to be interpreted as a state change.
What may be wrong here? I used a 10x probe. My scope is an analog 20MHz, 20MHz input bandwidth; is it too little bandwidth and some ringing spikes are escaping me?

Another interesting effect is that the same cable can program an AVR if it is clocked only up to a certain frequency. For example, I can program tiny26s reliably up to ~6MHz; if I clock the tiny26 faster, programming reliability decreases, being inversely proportional to the AVR's clock frequency.
At a first glance, it seems that the reliability should be independant of the AVR's clock, and dependant only on the cable's length.
I have this theory and would like your comments: the AVR samples the SPI programming lines at it's clock speed so, at higher frequencies, it can "see" the smaller ringing peaks that it won't see when clocked slower. If it is the case, it is in fact statistic; higher frequency => higher probability of catching a ringing peak. This means that even at a low frequency there's still some probability of the AVR seing a "dummy" transition on SCK, although most of the time it won't.

(As a side note: I have added RC filters to the SCK lines on the PC side, to slow the change rate, and stopped having reliability problems on my 60cm cable at all AVR clock frequencies (tested up to 16MHz). I think there was a thread mentioning that, but I can't find it; maybe by plons?...)

Any thoughs are wellcome :)
Thanks

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
It's well-known that the problems ..... etc
Now, that's an understatement ..... I wish it was so :)

Nuno, the thread is in the Tutorial section. Yep, indeed by me. I went through this as well. Some findings: a 20 MHz scope is hiding the ringing because of the limited bandwidth. I know from fellow-freaks that they were unpleasantly surprised about the quality of digital signals at the moment they hooked up a 100 or 200 MHz scope.

Quote:
Another interesting effect is that the same cable can program an AVR if it is clocked only up to a certain frequency. For example, I can program tiny26s reliably up to ~6MHz; if I clock the tiny26 faster, programming reliability decreases, being inversely proportional to the AVR's clock frequency.
I ran into that problem too. It was on a targetAVR that had an LCD-display hanging on the SPI-lines. Adding 1k in the lines from targetAVR to LCD solved the issue. Background: the HC244 has no hysteresus. The capacitive load of the LCD disturbs the comm.

regards

Nard

Edit: https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=36591

A GIF is worth a thousend words   They are called Rosa, Sylvia and Tessa, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ahhh... thanks for the link :). I'll post my experience there.

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Plons wrote:
(...)
Quote:
Another interesting effect is that the same cable can program an AVR if it is clocked only up to a certain frequency. For example, I can program tiny26s reliably up to ~6MHz; if I clock the tiny26 faster, programming reliability decreases, being inversely proportional to the AVR's clock frequency.
I ran into that problem too. It was on a targetAVR that had an LCD-display hanging on the SPI-lines. Adding 1k in the lines from targetAVR to LCD solved the issue. Background: the HC244 has no hysteresus. The capacitive load of the LCD disturbs the comm.
(...)

Well, this happens even when I don't have anything hooked up on those lines . That's why I think that the "SPI programming port" on the AVR is synchronous with the AVR clock.
My cable is totally passive.

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would very much appreciate some advice on building a 6-8 meters (20..25 feet) of ISP cable. My target is ATmega88 clocked 1.8432 MHz, and I am using Olimex AVR-PG2 parallel programmer (http://www.olimex.com/dev/avr-pg...) with avrdude.

My best try would be to use differential signalling over a twisted pair cable, however, I am not sure if it is an overkill or if it is not sufficient.

Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@nuno: I will give it some more thought .... it's been a while since I investigated the problem.

@andrei: IMO ISP over such a length will be difficult. You'd better consider a bootloader approach instead.

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia and Tessa, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess it depends on how much you want to spend...
You could use serial wireless modules, or add termination resistors (I can't help much here) and reduce a lot programming speed. I don't know if avr-dude allows you to set programming speed.
Maybe you should start by the basics: get the 8m cable and try. Then put RC an filter on the programmer's SCK line (at the programmer) and slowdown the programming speed. A good scope would also help...

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nuno, thanks for the programming slowdown tip! This might come handy.

Btw., the AVR under discussion is already on the top of the 6-meter post, and bringing it down for reprogramming is not easy either.

I'll do my best tomorrow.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

andreie wrote:
Nuno, thanks for the programming slowdown tip! This might come handy.

That won't be enough, because the main problem is the speed of the signal transitions. You really need the RC filter at the programmer's output (and only then you *may* have to slowdown programming speed, because now the transitions take more time).

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you guys!

I used 1kOhm resistor and 4.7nF capacitor on the receiving end of SPI CLK for the 10 meters of cable; and added "-i 100" to avrdude's command line. Worked like a charm.

However, it didn't work when the laptop computer was running on the car's 12V power through inverter. Problem solved by temporarily running on batteries for the duration of the programming.