Programming ATMega 168

Hi, I got an ATMega 168 preloaded with the Arduino bootloader, I also have a crystal, and capacitors.

As far as my understanding goes I can program it using a serial port by connecting rx, tx and dtr. I have a Prolific usb-to-serial adapter, what I dont know is if I can connect it directly to the usb-serial adapter or not. Can I do it? Or it will kill the ATMega?

It depends on what voltage your running the Atmega at. The adapter should be running at the same voltage.

The atmega should be at 5v, so as long as my serial port is at 5v too it will be ok?

a Prolific usb-to-serial adapter

Will have RS232 Voltage levels on the serial side (read Wikipedia for details).

These are NOT 5V and are also inverted compared to TTL level serial.

Typically a MAX232, or equivalent, is used as a level translator between RS232 and TTL serial.

To program an AVR microprocessor using the Arduino environment, you need a 5V (or 3.3V if appropriate) TTl level serial adapter that also brings out a modified version of the RS232 DTR signal, for the reset. Either RS232 to TTL or usb-serial adapters will work. If you aren’t comfortable soldering as follows http://playground.arduino.cc/Learning/AutoResetRetrofit you can buy ready made programming adapters (usually USB-serial) quite cheaply from a number of outlets. The crystal for the processor has to be 16 MHz.

Now I am confused, so my adapter may work? Can I simply plug it to the computer and measure the levels with a multimeter?

LoneWolf4:
Now I am confused, so my adapter may work? Can I simply plug it to the computer and measure the levels with a multimeter?

A link to your specific adapter, or it's model #, would help. As stated above it's likely to output RS232 serial, which are +/- 12v levels ... not the 0-5v TTL serial that your ATmega can tolerate. W/o specific info to the contrary I would not connect the two. If you have a DVM you could measure the resting state of the adapter, after it's been initialized, which should be a stop bit. That's 0v for TTL serial and -3v to -15v for EIA-232 (the new RS232).

Well a model number its something I dont have, its from a chinese online store (and it was pretty cheap).

Was the adapter advertised as being suitable for programming an Arduino? If not, it is most likely not suitable.

If you don’t have a reset pushbutton there needs to be a capacitor (somewhere) for the DTR signal. See the schematic for this bare bones kit, which shows an 0.1 uF cap in the DTR/RTS RESET line: http://moderndevice.com/product/bare-bo … d-bbb-kit/