stuff...

  • Increase font size
  • Default font size
  • Decrease font size
Home Hardware Hobby Programming AVRs

Programming AVRs

E-mail Print PDF
User Rating: / 2
PoorBest 

"Here i go again... (whitesnake song)"

I started in the avr stuff a year ago (maybe more). Note that I'm not an electronic engineer, not even an specialist hobbyist. I started in this world guided by my avionics impulses. I found in the web a DIY usb joystick made by Mindaugas Milasauskas. And that's how the story begins...

I needed a programmer. The web is full of schematics, cheaps, easy to build, blabla programmers. My experience told me that if you don't want to lose time, just build this one. It'll work. Forget about those telling you just to wire a few printer ports to the miso, mosi, sck and reset pins of your avr. This one will work and even more, it will protect your devices (pc, printer port, target, etc).

Believe me, I screwed up many times trying to build it. Wrong wiring (VERY WRONG WIRING, e.g. i mirrored the 74HC244), mismatches, lacking wires, etc. I could blow up anything. I guess I was lucky. The last 4 days I spent debugging my wirings, trying simple programmers and that sorts of things I have made a year ago when I started with the mjoy (that i successfully flashed). What am I saying? I was again at the very beginning that I was a year ago! And guess what? I had already purchased a LPT programmer on ebay (a really cheap one without protection) the one I used to flash my MJoy. You get lost, huh? Well, the thing is that now I was trying to flash an attiny2313 from a circuit of a good man I knew in this road to the avr. His name is Nard, the same of my previous article. No matter what circuit it is, what it does, who made it, why i built it. I had a programmer, I had a new circuit, and I had already programmed an atmega8 with the ebay programmer.

 

The things looks different now. My programmer was able to read the signature, was able to write the fuse bits - It actually wrote them - but in the middle of the flashing it stopped doing his work...(damn). The story is too long to tell it here. To be brief, I ended up disarming my working programmer (!!!). I was sure that it must be his fault! But I was wrong... Consecuence: 5 days of agony. 1 of disarming the working programmer to build Nard's dongle. 4 of completely madness debugging. But...I get it working...as a donkey I am! You know what? I like to see the good point of the things. I ended up building Nard's dongle! A valueable one, 'cause it protects you, 'cause it's safe and 'cause...he is my friend :). Also, my soldering skills grow up a lot. I used a lot of creativity, imagination, and deduction in those days (so, maybe you may think if I'll do it again...ABSOLUTELY NOT!).

 

ALWAYS KEEP THE TARGET BOARD POWERED WHEN YOU ARE GOING TO FLASH IT!!!!


It's trivial but, you already know that I'm not even a specialist electronics hobbyist. The power line (VCC) is used to power the buffer. "Buffer? what?" Well, while debugging I learned how that 74HC244 works. I have to. Thanks to that I solved my problem. The 74HC244 uses power. It uses to enable or disable inputs and outputs. Basically, it has two buses and 2 enable bits for each one. In my fourth day of debugging I found that pin 1 (the one that enable 1 bus) was lacking of a wire. Of course, before that, I checked if the lpt port outputs (yes, it really gives you ~3V) works, if my board receive the port signal and a lots of things. Take note, 4 days...Yes, four f*cking days! So, power is needed for the programmer. The programmer NEEDS to be powered somehow and it's not intended to be the LPT port that do that. Keep in mind that, you'll save 5 days (or maybe less if your are wiser than I am) of your life and a programmer. Also that's why they called ISP (In System Programming). It's because the socket it's made for use the target board power lines to feed the programmer and meantime the target micro is working you can flash it. Of course, there is a protocol. The avr will be on reset when flashing.

 

Ok, with that on mind I hope you are convinced. If you want to build an easy lpt programmer, this one is recommended. Remember two things: 1. It works! 2. It protects you These two notes seems not enough. I suggest you to read Nard explanation. He is a professional. He knows what he is doing. So, read Nard's notes before starting. Oh, and by the way, I'm not pretending to write how to build it. It's easy for a novice. What I pretend with this it's another note about programming avr. Few technical web pages tells you how procedure of flashing is. Almost all tells you about programmers and programs for flashing, even they show you code to probe it. This is a warning. So, you have been warned!

 

Following I'll show you how I made it with the 74HC244d smd from the ebay programmer. But before, my holydays workplace at parent's house:

I had to suit the smd-20-pin micro in a pseudo-proto board. Knowing that pins are more tied together at the half a distance than 2.5mm I thought in making my poors-man-socket:

This one took me a lot of patience, believe me. Cutting those short wires, soldering that in extremely short spaces and trying to keep all steady was a hard and stressful job. Here's more:

There's a little story before. I made the schematics with the eagle program. It links the pcb all together with the schematics. When you use smd components you need to mirror the device to use it in the bottom layer, but (always a but) if you are not smart enough you may forgot that you need to swap pins, as happened to me. Thats because the program shows you the bottom side of the board. Put it this way: Imagine you are seeing the board from below. Eagle it's extremely powerful and complicated too. It has a lot of diverse functions. You can specify everything. Lovely really. Ok then, I made the pcb, I printed out and then I used as a guide marking the completed jobs (or tracks). Take a look:

I didn't realized that when building it. The thing is that I supplied power to that. Not only to that. To the whole thing. The target board and the programmer itself. Remember that it was connected to the parallel port! And also I tried reading the target avr! Not even that, the proto-programmer was full of mismatches and mirrored!...so, who knows who there?!?

Pin1: I should be ¬OE! pin20: Shut up! you are grounded! (lol, take note the phrasal joke) pin10: Oh yeah, and you are VCCed! Anyway, I really made a frankenstein programmer! I get mad. Really mad. At this time I didn't know how 74HC244 works. Maybe the solution would came earlier but you know, that's life. I spent time looking it, watching it, damning it, trying to put a curse on it, and so on. Schematics and pcb was front of me. Below me, the programmer. I went down the eyes and I see it! Mirrored! F*cking holy crap! (sorry, I just couldn't stand it). Ok, let's calm down. Let's see if we can reuse that socket! It took my a lot of time build it. Nope, useless. Think...Ok, strips. Double row strips. They are exactly at 2.5mm aligned. But, we have two rows! so, let's bend down the row from behind!:

I started again with the last pseudo-proto board in my stock. Days has passed by, so I decided to apply what I've learned. I wrote every mark, note, number, astrologic symbol or whatever in the pcb, in extra papers, pinout and etcetera. Every thing looks fine I said to myself. I've done all tidy, structured. It'll works...

I think you are guessing that no, It hasn't worked. Again: debug. I spent so many time debugging that I could say that maybe I like it... :?: Finally, I used a program that Nard mentioned me: "ParallelPortViewer". Oh shit, I should boot windows! ok, no problem, the cause is good! xD The program allowed me to see that something was wrong with the buffer. I've already understood how it works, so at least bright that led motherf*cker! Have to say that if that led had not been there, I wouldn't be able to do it. What I did? I insisted on brighting that led up. I used the ParallelPortViewer program to send data through the parallel port. I used the active low logic of the 74HC244 of pin one to enable the led bus. That way, making the correspondent pin grounded the led will bright up. Sounds good, huh? Ok, a good point for me! :) Now my objective was to bright that led up, if so, at least the 74HC244 was alive. If not, then I blow up when mirrored :( Luckily, the buffer was right, I was right and the board was wrong. Concentrating only on the requiring pins I realized that I did not wire the ¬OE pin to the correspondent site. After that, led brights up. Time to see if I can read the avr!

Let's put that parts together. I have a pretending working programmer. A target board. An lpt socket adapter I made. A 10pin adapter male-male I made (for the board. Useless? mmmh, not for me, I hate soldering wires. They move!!). An improvised +5v from the printer usb cable and luckily a stocked usb socket. Could it just work? Holy please!!

Yes, it works :)

 

I'm able to read/write avr with a protected and safe dongle made by Nard, isn't life beautiful? Hey mate, thanks! :)





Free web hostingWeb hosting
Last Updated on Monday, 25 January 2010 01:28  

Add comment

Be polite.


Security code
Refresh


polls