Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Plons
PostPosted: Mar 14, 2006 - 10:41 PM
Raving lunatic


Joined: Nov 01, 2005
Posts: 6606
Location: Hilversum - the Netherlands

Edited February 5, 2008

I just received a newsletter where Kanda says that the AVRISP-software for STK200, 300 and alike, is now free to download, and can be used as plug-in in AVR-Studio.
http://www.kanda.com/avr-isp-software.html
Good news ! Enjoy.



Edited November 16, 2007

This tutorial thread has grown too long for easy use. You can find the latest info on my website: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
There is also a dutch version: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20Nederlands.html

And please read the information that's given there.

End of Edit


Newbies on AVR rarely start off with a fully equipped programming environment. For them the Parallel Port Programming Dongle (PPPD in the rest of this topic) is an easy to build and cheap programming-tool. On the internet schematic diagrams can be found easily. But even commercial products, like the STK200 come with a PPPD and they are ready-built available as well.

Note: An other name used for PPPD's is: AVR ISP. A confusing name, as In System Programming ( ISP ) is a common feature of AVR Microcontrollers. And AVR-ISP is used by Atmel and on AVRFreaks for the RS232-programmer with a 90S1200

These PPPD's can cause a lot of headaches and confusion, as there is a problem with these programmers, causing it to fail or function unreliably.

This topic will give you some insight ...... and solutions of course Wink

March 14, 2006: I posted this topic in the AVR Forum some time ago and as questions about PPPD's keep popping-up, the Moderator of this Tutorial Forum (abcminiuser) invited me to re-post here.

I implemented the suggested improvements as done in the original thread http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=33265




Solutions to problems with Parallel Port Programming Dongles, STK200/300-programming dongles and alikes.

This time not a Question, just Answers

In the past there have been quite some articles about programming-problems with these dongles and other dongles with a simular design. I am talking about the AVR-programmers with a 74HC244 buffer, on the printer- (or parallel) port of the PC.

Two types of problems:
1 from: "does not recognize chip", ID="some rubbish",
to: it does not work, pls help ....
2 from: It damaged the printerport on my PC
to: it works on one printerport but not on an another

Good suggestions so far:
- Increase the programming-delay
- In BIOS: set printerport to EPP or ECP
- Use a shielded printercable
and other suggestions:
- Buy yourself a better programmer ... it is unreliable
- and some confusing suggestions ... that really do not help.

The story:

A few months ago, I purchased a STK200 with Kanda (UK). The board came with this programming dongle and it worked fine. Until the parallel port on the motherboard of my PC was damaged by the dongle.... Luckily I could fall back on a PCI-card which gave me another parallel port. But I was worried ..., and not pleased ...

For a new project with two Atmel uC's, I needed a second programmer. So I built one. The famous design with the 74HC244. And to suit my needs, I made it with another type of connector for the target-board. IT DID NOT WORK ! Why? Did I make a mistake? No, I did not ...

Hmmm.

In order to program the new targetboard (with the new connector), I made an adapter for the existing and working STK200-programming dongle. And with the new connector it DID NOT WORK EITHER !! Can a connector make the difference?

I was confused .... for a moment. I started searching on the Forums and discovered that I was not the only one ... But suggestions for a solution did not do the trick so far ... I do use a shielded cable, the BIOS-settings are OK, I increased the programming-dalay, etc

I decided to sort this out. And dig it out, .... to the bottom !

To start: I like the design with the HC244. It looks good. Well done, designer! The 74HC244 buffers the signals between PC and targetboard, and isolates the two when the programming is done.
Many people use this interface as it is cheap and easy to build. And is comfortable to use in combination with Bascom AVR.
Note: although some Forum-members claim that it is not supported in AVR-Studio-4 (the beautiful programming-environment from Atmel): sorry guys, that is not true! Kanda supplies a plug-in for AVR-Studio with the STK200 and it works fine! And comfortable.

Edit: From time to time I receive requests via PM, to share the Kanda-plug-in. I will not do that. It's licenced software. Contact Kanda to get your own licence, or use PonyProg to program your AVR's
Plons, May 14, 2006


Back to business:

Q. What makes this dongle unreliable?
A. LONG LINES, my friends!
Fourier, La Place, thank you for the insight. And thanks to my teachers! Although that's some time ago ...
The combination of short rise- and falltimes (high slewrate) on the signals and the (relative) long lines for these frequency-domains (using Fourier and La Place), that is what's making these dongles unreliable.

What I did:
I hooked up an oscilloscope to the SCK-line on the targetboard and it was obvious: RINGING, i.e. oscillations right after a fast transition of the SCK-line.

Q. What happens during programming in the original design?
A. The uC on the targetboard looses synchronization with the programmer. It sees more than one SCK-edge due to the ringing. And that's what I read some time before ... an Application Note from Atmel. AHA. Now things fall in place. The puzzle is complete, and the picture well visible.

I needed to get rid of the high-frequency-components generated by the edges. The trick: a small RC-filter of 0.1 us, made up with a resistor of 1 Kohm and 100 pF capacitor. That's all it takes: one small filter in the SCK-line. I built it into the STK200-dongle and ran some tests: problem solved. No longer dependant of connector/cable.
Built it into the second programming-dongle: works.
Hooked them up to another PC: works.

Let's go to the second problem:
Q. Why did the dongle blow the printerport on the motherboard?
A. I was not carefull enough.

Some explanation is needed here. The dongle is connected to targetboard and PC. Suppose both are powered down. When the targetboard is switched on, and the PC is not, the dongle will force current into the printerport's /Ack-line.
Q. Can that do any harm?
A. Yes!
To understand this, some historical facts about the printerport.
In the original IBM-design, the printerport was made up with a 74LS374 and a 74LS244. To blow that port you really needed to use brute-force. Hook it up to 24 VDC f.i. Wink It was a very rugged design.
Nowadays, the printerport on a motherboard is built-in an ASIC, which has far more functions, but is not as rugged as the original design. The 74HC244 in the dongle can supply 25 mA (guaranteed) on an output-pin, and I am afraid that was too much for the ASIC. The good news is that the rest of the printerport still works OK. But it can no longer be used for this dongle.

So: limit the current in the /Ack-line by inserting a resistor. The other lines are all inputs on the 74HC244 and therefor , basically, need no limiters. However, I do think it's better to insert current-limiters there as well. Why?
Of course we all know that the parallel port and RS232-port are not hot-pluggable .... Wink , but most of the time I treat them as such. I know, ... bad habbit.
By taking some extra measures, the dongle can be made such, that it will probably not do any harm to plug it in while the PC and/or the target-board are powered (although NOT recommended)




Some FAQ's

Q. Is it necessary to add the filter to MISO and MOSI as well?
A. No. The data on these lines are set-up before the SCK-edge occurs. So even if there is ringing on these lines (and there is !!), it has no effect on the transmission. But: it's a good idea to filter these lines as well.

Q. Is this the ultimate solution?
A. Depends how you look at it. Adding a filter (an analog circuit) to a digital clock-line is something I preferably do not do, .... usually.
But in this case it's the best I could think of, ... in getting a simple solution.
The good thing is that it is not acting as a delay for the clock-pulse: that's a designer's nightmare. All it does is reducing the slewrate of the clock-signal. The best solution .... I'll give it some thought

Q. Could this apply to other programmers as well?
A. I think it does.
- Looking at the design of f.i. the AVR-ISP: the 90S1200 connects to the targetboard with no slewrate limiters at all. And if the cable between programmer and target is short, that will work fine. But Atmel's uC's are PDQ-things and have very short rise- and fall-times on their I/O-pins. So if you're using a longer cable, the same problem might occur.
- Looking at the serial programmer (SI-PROG) from PonyProg: here the problem will NOT occur as in the RS232-specification provisions were made for slewrate-limiting. Clever guys at that time, huh?
- The programmer ZL2PRG on the MCS-site: it looks like it is lacking this filter as well.

Quite some text huh?

As attachments you'll find an ImprovedVersion and an EvenBetter version, in case you're gonna build a new one. I also added a picture of my modified STK200 PPPD

I hope this solves many problems ... in my case it did. Have fun and happy computing .... eh, programming.

Plons





Some additional suggestions and/or recommendations:

1 Do not plug-in or unplug the PPPD from the PC when either PC or targetAVR are powered-on
2 For PPPD to work properly, Vcc of your targetAVR must be 5V
3 If you use the STK200 as target, 3.3V for the AVR is OK as the STK200 has some additionally circuitry to take care of the different levels
4 If you need to disconnect the programmer from your targetAVR, first turn AVR's power down
5 Leave the PPPD connected to the PC; there is no need to unplug it
6 If you're using a ParallelPort extension cable, make sure it's a shielded one, not longer than 1.8 mtr
7 Check your PC-BIOS for ParallelPort setting: EPP or ECP, not SPP
8 Be aware that in the original design of STK200 (and possibly more), the ribbon-cable between PPPD and the target-board is reverse-connected: pin no.1 on one side is NOT pin no.1 on the other side. I am not very fond of these "specials" but changing it NOW could cause even more trouble. So check the connections BEFORE applying power.



Links:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=35048 abcminiuser made a programmer from a Butterfly: he's a magician ...
http://www.lancos.com/prog.html PonyProg website
http://www.atmel.com/dyn/resources/prod_documents/DOC0943.PDF Atmel AVR910 Application Note

<more to come>

Nard


Last edited by Plons on Feb 06, 2008 - 12:05 AM; edited 3 times in total
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Plons
PostPosted: Mar 30, 2006 - 11:04 PM
Raving lunatic


Joined: Nov 01, 2005
Posts: 6606
Location: Hilversum - the Netherlands

Although I have a USB-programming dongle (came in yesterday), this PPPD is still my favourite. It's fast, and as long as you stick to the "recommendations", it's a good programmer.

There was one thing though that bothered me: I had to lower the resistor in the /Ack-line from 1 kOhm to 180 Ohm because of the pull-up in the PC's Parallel Port.
I've come up with the following solution: replace the 180 Ohm with a BC547 and 3 resistors of 10 kOhm. (choice of transistor-type not critical, almost any general purpose small signal NPN-transistor will do)
The circuit might look a bit weird at first glance, but it works. Rolling Eyes

I'll be honest with you: I didn't test it. I simply stick to the rule: don't plug / unplug from PC when powered-up.

I have two requests:
1. If you're in the process of building an Even Better PPPD, go for the version of March 30 2006, and let us know the outcome
2. If you are an experienced user of a schematic-entry program, please be so kind to redraw the schematic.

Plons
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Plons
PostPosted: Jul 26, 2006 - 02:02 PM
Raving lunatic


Joined: Nov 01, 2005
Posts: 6606
Location: Hilversum - the Netherlands

Additional info: I spoke with KKP about this (in an other thread), and he recommended the use of 330 ohms / 330 pF for the anti-ringing. That is IMO a good improvement because of this: if there is some more capacitive load on the ISP-lines (target-side), f.i. an LCD sharing the same lines, the 1 kOhm might be too high for reliable operation.

It would be nice if the schematic was redrawn ..... so I repeat my requests:

1. If you're in the process of building an Even Better PPPD, go for the version of March 30 2006 with the 330 / 330, and let us know the outcome
2. If you are familiar with some schematic-entry program, please be so kind to redraw the schematic and post it here.

I could do al this myself of course, but doing things together is much nicer.

Regards

Plons

_________________
Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
cb951303
PostPosted: Aug 09, 2006 - 08:52 PM
Newbie


Joined: Aug 09, 2006
Posts: 4


hi guys, this is my first scheme so if there is anything wrong about it please report to me, I will use this to create an autorouted PCB, thanks in advance[/img]
 
 View user's profile Send private message  
Reply with quote Back to top
cb951303
PostPosted: Aug 10, 2006 - 01:15 AM
Newbie


Joined: Aug 09, 2006
Posts: 4


For now , autorouted PCB looks like this, I couldn't get less jumpers so I added some pads and traces to be able to work with jumpers at "74hc244" and "pin header" leads

does it look ok to you?

thanks again
 
 View user's profile Send private message  
Reply with quote Back to top
Plons
PostPosted: Aug 10, 2006 - 11:23 AM
Raving lunatic


Joined: Nov 01, 2005
Posts: 6606
Location: Hilversum - the Netherlands

Thanks for your work here ! What program did you use ? Eagle, ExpressSch ?

I had a look at it, and here are some recommendations:
Schematic: R17 R18 and R19 : should be 330 ohm as well. Schematic is a bit hard to read; the vertical lines are very close together.
For the ISP-connector: have another look in the library of your program, and see if you can find a better one. Adding signal-names would help as well. But heh, for a first time .... well done !

Layout: in single-layer layouts, jumpers are not unusual; the one on the right will be difficult to put in, as the connector is occupying the pin. And the auto-router didn't know what to do with R12 to shield of the subD

Keep up the good work

Plons

_________________
Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
cb951303
PostPosted: Aug 10, 2006 - 08:15 PM
Newbie


Joined: Aug 09, 2006
Posts: 4


Plons wrote:
Thanks for your work here ! What program did you use ? Eagle, ExpressSch ?

I had a look at it, and here are some recommendations:
Schematic: R17 R18 and R19 : should be 330 ohm as well. Schematic is a bit hard to read; the vertical lines are very close together.
For the ISP-connector: have another look in the library of your program, and see if you can find a better one. Adding signal-names would help as well. But heh, for a first time .... well done !

Layout: in single-layer layouts, jumpers are not unusual; the one on the right will be difficult to put in, as the connector is occupying the pin. And the auto-router didn't know what to do with R12 to shield of the subD

Keep up the good work

Plons


thanks for the comments, I'm working on a better one now, when it's finished I'll post it here...

I used a program called diptrace for this, I tried eagle but I couldn't find a 25 pin connector in library so I switched... anyway diptrace seems good enough for now, if you have any suggestions for software, I can try because like I said it's my first time and since I'm learning it's better to start with a recommended software Wink

thanks again
 
 View user's profile Send private message  
Reply with quote Back to top
Plons
PostPosted: Aug 10, 2006 - 08:38 PM
Raving lunatic


Joined: Nov 01, 2005
Posts: 6606
Location: Hilversum - the Netherlands

Many folks on AVRfreaks use Eagle. So from compatibility point of view that's a good idea.
I prefer ExpressSch, as it is far more intuitive to use (IMO, guys !!)
Can be found at expresspcb.com

Plons

_________________
Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
mneary
PostPosted: Aug 10, 2006 - 09:30 PM
Raving lunatic


Joined: Sep 25, 2003
Posts: 2189
Location: Los Angeles, USA

In Eagle, the D connectors are in the library 'con-subd'.
 
 View user's profile Send private message  
Reply with quote Back to top
pquinton
PostPosted: Aug 12, 2006 - 09:05 AM
Rookie


Joined: Jul 14, 2006
Posts: 27
Location: United Kingdom

Plons wrote:
1. If you're in the process of building an Even Better PPPD, go for the version of March 30 2006, and let us know the outcome

I built one!... and out of all the dongles I've put together.. this one works. Tested with avrdude. Used it to re-flash my AVR Butterfly.

I wipped it together on a piece of stripboard...

I've got a couple of suggestions if someone is going to put together an application note on building this:

1. Don't assume the builder knows they have to power the Target AVR for it to work.. I didn't. It took me a while to figure it out (I'm a newbie).

2. Also.. I had a few basic problems with GND. I popped an LDO 5v regulator on my board to drive the VDD line (to the buffer and the AVR). The 5v reg was driven by an external wall-supply.. Originally the circuit GND for the dongle ended at the parallel port, and the GND for the target AVR ended at the Voltage Reg, both seperate. Obviously this didn't work ( you can tell I'm a newbie Smile ). I soon realised that I needed to common all the grounds to the parallel port. After which everything sprung into life. It would be nice for a few instruction to this effect in an app. note.


Thanks for the design guys.. I used to play around with PIC chips (urgh.) and ended up buying a 100 programmer for them (it was a while ago!) and you've saved me having to buy one for AVR's... Most appreciated.

Phil.

_________________
"If they did that in Manchester, they'd be chinned"
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
cb951303
PostPosted: Aug 12, 2006 - 11:15 AM
Newbie


Joined: Aug 09, 2006
Posts: 4


Quote:
I soon realised that I needed to common all the grounds to the parallel port. After which everything sprung into life. It would be nice for a few instruction to this effect in an app. note.


what do you mean by that, (yes I'm a newbie too Very Happy)
 
 View user's profile Send private message  
Reply with quote Back to top
Plons
PostPosted: Aug 12, 2006 - 01:47 PM
Raving lunatic


Joined: Nov 01, 2005
Posts: 6606
Location: Hilversum - the Netherlands

Phil, if I understand you correctly, you built the one with the extra transistor ?!
Good to hear that it works. Thanks for letting it know.

Being a newbie, you'll encounter more newbie-problems. Don't be alarmed .... it's SOP (Standard Operating Procedure) ... it's part of the game.

Happy computing you both

Plons
(building a new programmer based on a Butterfly and Dean's ButtLoad)

_________________
Dragon broken ? Or problems with the Parallel Port Programmer ? Scroll down on my projects-page http://www.aplomb.nl/TechStuff/TechStuff.html for tips
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
pquinton
PostPosted: Aug 12, 2006 - 03:17 PM
Rookie


Joined: Jul 14, 2006
Posts: 27
Location: United Kingdom

Plons wrote:
Phil, if I understand you correctly, you built the one with the extra transistor ?!
Good to hear that it works. Thanks for letting it know.

Yep, the one with the extra transistor, and I added a V.Reg as well. I also used the 330/300 combination with the resistor/capacitors.

Cheers.

Phil.

_________________
"If they did that in Manchester, they'd be chinned"
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
pwillard
PostPosted: Aug 21, 2006 - 01:21 PM
Wannabe


Joined: Dec 30, 2005
Posts: 55


Wait... you added a V.Reg? Are you powering the dongle and supplying ISP port power "to" the programming board?

pw
 
 View user's profile Send private message  
Reply with quote Back to top
pquinton
PostPosted: Aug 21, 2006 - 04:47 PM
Rookie


Joined: Jul 14, 2006
Posts: 27
Location: United Kingdom

pwillard wrote:
Wait... you added a V.Reg? Are you powering the dongle and supplying ISP port power "to" the programming board?


The V.Reg drives the dongle AND the Target AVR, yes.

Phil.

_________________
"If they did that in Manchester, they'd be chinned"
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Russel
PostPosted: Aug 21, 2006 - 09:16 PM
Newbie


Joined: Aug 19, 2006
Posts: 1


Quote:
The V.Reg drives the dongle AND the Target AVR, yes.

How do you power the target AVR after you disconnect the dongle?

IMO, the correct way is that the dongle should be powered by the target AVR circuit.
 
 View user's profile Send private message  
Reply with quote Back to top
pquinton
PostPosted: Aug 22, 2006 - 08:43 AM
Rookie


Joined: Jul 14, 2006
Posts: 27
Location: United Kingdom

Russel wrote:
Quote:
The V.Reg drives the dongle AND the Target AVR, yes.

How do you power the target AVR after you disconnect the dongle?

IMO, the correct way is that the dongle should be powered by the target AVR circuit.


OK.. maybe I'm not explaining this quite right..
The 5v output from the V.REG goes to the VDD line to the 'right' of the diode on the dongle circuit. So power is applied to both the buffer and the target AVR. The VDD to the target AVR is sent down the 'cable'.. so when I've finished programming, the removal of the 'cable' disconnects the VDD from the AVR.

Does this make more sense?

Cheers.
Phil.

_________________
"If they did that in Manchester, they'd be chinned"
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
denidoank
PostPosted: Aug 25, 2006 - 10:40 AM
Newbie


Joined: Mar 27, 2006
Posts: 12


I'm sorry if this is out of topic.
it's too bad I don't read this thread before, cause now my parallel port is damaged. maybe its because I often plug and unplug my dongle when pc is on. now I decided to use serial port to continue my work with avr and I found si-prog from ponyprog. There is one ic lm2936 on that circuit but in my region that ic is not available, and there's notes that this ic shouldn't be replaced by lm7805, why is that? It's possible to substitute lm2936 with lm2931? cause only lm2931 is available in my region. And its more expensive than lm7805. Thanks for help. Sorry for my language, i don't used to with english.
 
 View user's profile Send private message  
Reply with quote Back to top
pquinton
PostPosted: Aug 25, 2006 - 12:09 PM
Rookie


Joined: Jul 14, 2006
Posts: 27
Location: United Kingdom

denidoank wrote:
There is one ic lm2936 on that circuit but in my region that ic is not available, and there's notes that this ic shouldn't be replaced by lm7805, why is that?


The LM2936 is an LDO (Low Dropout) Regulator and Surface mount. LDO's are excellent for battery operated solutions as they the can regulate very close to the input voltage.. standard regulators need a few volts difference.. ie.. 8-9V input for a 5V output. Where as an LDO can go to about .2/.5v from the input.. ie.. 5.5V input for a 5V output..

Well that's the way I understand it..

I don't see why you couldn't use a different regulator as long as it'll do the job, supply sufficient current (don't as me how much, I don't know), and has minimal ripple.

Anyone else have any other reasons?

Cheers.
Phil.

_________________
"If they did that in Manchester, they'd be chinned"
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
japroach
PostPosted: Aug 27, 2006 - 12:23 PM
Wannabe


Joined: May 28, 2006
Posts: 50
Location: vancouver

pquinton wrote:
I don't see why you couldn't use a different regulator as long as it'll do the job, supply sufficient current (don't as me how much, I don't know), and has minimal ripple.

Anyone else have any other reasons?

Cheers.
Phil.

As long as its a LDO it should be fine. Another reason is less bias current, a 7805 uses 10's of mA while a LDO is usually uA's.

and I believe the serial port can source 20mA of current.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits