Serial programmer not working, what are the possible problem sources

avrprogrammer

I have been trying to make a serial programmer for AVR chips. I have been using this schematic as reference, http://www.elektronika.lt/_sys/storage/2004/05/06/avr_prog.gif.

I made the circuit and have checked that the connections are correct. Here is a picture of it on breadboard

CKT on Breadboard

The problem is it doesn't even get detected in linux.

rick2047@Sophiya:~$ setserial -g /dev/ttyS*
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
rick2047@Sophiya:~$ dmesg |grep ttyS
[    0.220488] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.221036] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
rick2047@Sophiya:~$ 

In window there is a com3 and com1 but cannot connect to com3, it says check your port settings.

I checked the bios and there is only a Serial Port A in the peripherals section. Does that mean I can use only one serial? My monitor is an old CRT which runs on serial cable.

UPDATE
The monitor is on VGA. So why does this not work?

rick2047@Sophiya:~$ avrdude -p atmega8 -P /dev/ttyS0 -c ponyser -V -U flash:w:test1.hex 

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

Best Answer

I was recently making a very similar serial programmer too, and had lots of problems with it.

First, check your crystal for the AVR. I can't see much on the photo, but its ground should be directly connected to power supply's ground. I've read that sometimes breadboards can make problems if the ground is connected through them because of impedance. Still, if you're programming a fresh AVR, it's going to be running on its own internal oscillator, if it has one.

Next step is to check if the AVR is getting correct voltage when connected to the programmer.

When you power on insert the AVR, check voltages on each pin and see in the datahseet what that pin is supposed to be. Some AVRs may need multiple ground connections and multiple voltage sources, especially if it has analog to digital converters.

Make sure that all your grounds are at same voltage. That may seem to be obvious, but I forgot to connect GND on my ATmega162 and even without GND, it managed to flash LED while running on internal oscillator.

I agree with starblue about capacitor. Read the datasheet for the AVR you're using and AVR Hardware Design Considerations document. It should provide some more information on proper decoupling.

Next step is to get a program which can tun on and off a pin on the serial port. You should use something like that to check if you have connected the programmer to the port you're attempting to use. Turn on a pin and check voltage on AVR socket. If you're not getting correct voltages, there's something wrong with your setup, so check everything again.

Now that I'm talking about setup, I noticed that there's nothing on Vs+ and Vs- pin of your MAX232. From a datasheet I'm reading, they should be connected to +8.5 V and -8.5 V and have 1 µF decoupling capacitors. On my setup, I connected one side of the capacitor to the pins and the other to +5 V and GND, since I didn't have needed voltages. I read that in a on-line tutorial, so I don't know if it's the best setup, but it works for me.

Do not expect the programmer to be detected by your computer. It doesn't communicate with computer at all! Instead, it just converts pulses which computer sends to what AVR can see. Also, there's no plug and play for most serial devices.

If you're still having problems, you'll need an oscilloscope to see what's happening. I didn't have one, so I took an audio cable, cut off one of its ends, placed a voltage divider there and connected the other end end to microphone input. There are numerous tutorials on the Internet on how to build the probe. Here's the one I used. I used Soundcard Scope to see the what kind of signal I'm getting. There should be a clock signal on the SCK and you should be getting signals on MOSI and MISO too. Reset should give you just a few signals, when the AVR needs to be reset.