Author Options:

Need some help in the Ghetto (AVR programming)

So I got my old printer cable cut up and wired to a tidy DB9 connector, and I've rechecked all the wiring about 6 times, comparing my connections to all the pictures and the pinout schematics from the ATMEL website, and I'm convinced that everything is correct ( that's obviously the problem right there). Running WINAVR, compiling the LED_Demo program goes fine, but the software is not able to communicate with the ATTiny2313. I tested the connection with the avrdude commands (avrdude -p t2313 -c dapa -P lpt1 -n -v) and the results suggest that communications are just not happening. I tested the parallel port by hooking up the printer, and that went fine. I'm out of ideas as to what to check. Any help out there?

14 Replies

CTroyer (author)2008-10-13

The latest ; AVR Freaks.net has an excellent article by 'Plons' that describes the problems I've been having. So I built the programming cable to the specifications there. I'm still seeing no communication with the ATtiny. I suspect that I destroyed part of my parallel port with hot swapping the cable. Now I wait for my new oscilloscope to arrive from ebay. It's amazing what's out there. When I find out what's going on - I'll post some more. If I ever manage to blink an LED, I'll post to the original instructable.

CTroyer (author)2008-09-29

After reading six more websites that all insist that the dapa approach works, I rebuilt my cable, this time with the 150 ohm resistors in place, about 8 inches long, everything tidy and secure - sending data to the chip through avrdude looks like it's working, but always comes back with errors the the write didn't actually happen. Messing around with avrdude in terminal mode, it looks like I can erase the eeprom or flash data, but any kind of a write fails. I tried adding a delay with the -i switch; it did make things go very slowly, but no improvement on the results. Dang.

gmoon (author)CTroyer2008-09-30

You're sharing the gnd with the Vcc source and the DAPA cable, right?

I've been able to read data through the DAPA interface with no power applied to the AVR at all...some sort of parasitic voltage through the cable...but writes fail...

CTroyer (author)gmoon2008-09-30

Yes, there is one ground wire connected to the ground on my power supply and pin 10 of the 20 pin socket. That pin is connected to the ground (pins 18-21 on my parallel port.) I also added a power indicator LED on my board, as I found out today that the fuse was blown on my power supply. It hums just the same without the fuse, but it doesn't provide any output....According to the AVRfreaks wiki, the clock rate on an ATtiny2313 fresh out of the tube is 1MHz, so the baud rate in avrdude needs to be set low. Baud rate needs to be less than 1/4 the clock frequency of the chip for synchronization to work; I tried with -b 60 -i 1000 and still got nada. Took a while though....The fun thing I found out last night is that avrdude 'looks' like it is writing and reading whether a chip is present in the socket or not. The data 'read' from the chip always come back as zeroes. Ah well, back to the wiki. There was some interesting discussion of the lock bits, but I think my problem is more fundamental....

gmoon (author)CTroyer2008-10-01

It was just a thought. You mention "socket"...so it's on a project board of some sort, with an ISP connector? At this point, I'd move the AVR to a solderless breadboard with power and ISP connections only, and try that.

CTroyer (author)gmoon2008-10-01

By 'socket' I mean the 20 pin connector that the AVR sits in. I haven't purchased a solderless breadboard yet, so I'm wiring things up on a project board, much like the one in the instructable. I have a battery pack set up with 3 'C' cells ( I thought that was appropriate, as I'm also programming in C) , a switch, and a power on indicator LED, and that's it. I just wired the switch in tonight; when I relocated the wire for the power on indicator, I found that the LED has power when I plug in the DB25 connector, without the battery pack switched on. There is 1.75 volts coming from one of the other 4 wires, through the chip, lighting the power indicator, and going back to ground. I thought that was curious, so I checked voltages at each pin with the dapa cable plugged in and unplugged, with and without external power supplied. I'm headed over to the AVR freaks forum to ask what the voltages should be with this sort of cable and chip. I also got the address range for the parallel port squared away. I had to start calling it LPT3 and manually change some settings in Windoze, and now instead of reading all zeroes, I can read endless strings of f's......YAY progress!

gmoon (author)CTroyer2008-10-02

I think the voltage you're seeing on an unpowered (but ISP connected) AVR is the "parasitic" effect I mentioned above. The AVR will even respond to some ISP commands, but there's not enough voltage or current to write to the flash mem. Good luck on the rest. On my end, I can say for sure the DAPA cables work.

CTroyer (author)2008-09-27

Dang, looks like I failed to post my last comment. To sum up, I tried reducing the power supply to a pair of 'C' cells - got exactly the same results as before "AVR device not responding - initialization failed rc= -1" Tried a new 2313, same result. Swapped back to an old one tried reversing the polarity. Got hot enough to almost burn my fingers. Latest attempt was to bypass the tidy DB9 and solder directly to the chip socket. Still no go. I'm ready to try a slightly more complicated arrangement from the AVRwiki site. (But still cheap....)

gmoon (author)CTroyer2008-09-28

Here's a nice tutorial on AVR programming with a DAPA cable. It was the link that got me started.

It's Linux-oriented, but maybe the pictures and schematics will help you double check your cable and setup.... It's not the 2313, but the ISP pin names (MOSI, MISO, etc.) are the same.

gmoon (author)gmoon2008-09-28

One more thing--there's a definitely limit to the length of a DAPA cable, and it's approx. 70cm. My working cable is about half that length.

CTroyer (author)2008-09-27

Here's the latest; I wired up a pair of 'C' cells to provide power to VCC. I tried the last of the three ATTinys I have on hand, (up until now untouched) but I got the same results that I've seen with the other two. So I swapped back to the first one, and thought to try swapping the polarity. It couldn't get any worse than not working...... But that chip got hot enough to almost burn my finger. So I guess I had it correct to begin with, and the problem lies further upstream. (PEBKAC) I bet that switch mode neon transformer made a cool sound when it went up......Thanks for the input.

gmoon (author)2008-09-27

Some thoughts... -- 2313 powered correctly? (any chance you bricked it already w/ polarity issues, etc?) Do you have another AVR to try? -- The DB9-- that's not the connector on the PC side, right? DAPA is parallel port (DB23 connectors), not serial. -- Have you to enabled the parallel port? There's a batch file, something like "install_giveio.bat" you need to run if you're using XP or Vista. -- Check the wiring like 6 more times....

CTroyer (author)gmoon2008-09-27

Oh, yes, it is entirely possible that I've destroyed the chip. I'm using the old computer power supply hack to provide the juice. I'm certain that the polarity is correct, but I think I'll fall back to using batteries for the moment. Then I'll try another chip. I haven't let the magic smoke out of anything yet, so I don't think that I've fried anything. I did run the install_giveio.bat , and also a handy status_io.exe from the same /bin folder that says that everything on the LPT1 side is hooked up and OK. And, no the DB9 is only on the AVR side. I'm using the DB25 printer cable to connect to the parallel port on my laptop (ThinkPad 600) , and then a DB9 on the other end, just to make things tidy. I chased the wire connections to pick out the 5 useful ones, and wired them up to the DB9 end. When I test for continuity I'm checking from the parallel port connector pin back to the cradle, and everything seems to be lined up correctly. Thanks, I'll get a battery holder wired up, and try again.

guyfrom7up (author)CTroyer2008-09-27

I never had luck with the ghetto programmer, but that might just be me. one day I just made the leap and spent 10 dollars on ebay for a proffesionally made avr programmer. Stuff doesn't have to smoke to be fried, all though that is a sign of a definite fried chip. Also if a chip exploded then it's fried *looks over at switch mode neon transformer*