This is my first article. There are many areas about creating an instructables which I am new.
I just like to share a simple circuit and hope it helps those starting out with AVR who does not have a programmer and like to build one.
This article is about building a serial TTL breakout pcb using CH340G.
You can use it to program Arduino bootloader firmware on to a blank ATMEGA328 for Arduino board.
You can also program USBTINY ISP firmware on to ATTINY85 to make a USB AVR ISP.
NOTE : the red jumper wire on the bottom side of the PCB is added due to a broken trace during etching.
Step 1: The Circuit
1 x CH340G IC
1 x 12MHz crystal
2 x 1N4148 diode
1 x 10nF ceramic capacitor
1 x 10nF capacitor
1 x 100uF capacitor
1 x 2x5 pinheader
1 x 1x4 pnheader
1 x homemade PCB ( above image is 600dpi )
This main IC is CH340G which is a USB to serial convertor.
Windows drivers for the chip ca be downloaded from http://www.wch.cn/download/CH341SER_ZIP.html
D1, D2 diode and JP1 is for selecting 5V or 3.3V operation. ( 3.3V is not exact. It would be about 3.6V)
Decoupling capacitors for crystal has been remove to reduce the PCB size and component count.
All RS232 signals are routed to pinheader SV1.
JP2 is for RS232 assist operation, which inverts RXD signal if shorted. ( Not sure what this function is for but added it as it part of the chip's function. Maybe it is useful for future project.)
The circuit can be use for serial TTL operation.
You can also use PL2303 but the schematics has more components.
Step 2: Using the Breakout PCB for AVR Programming
It can also be use with AVRDUDE to program ATMEL MCU such as ATMEGA and ATTINY series MCU.
The purpose is not to use it as a regular AVR programmer as t would be slow.
It is more suitable for programming a MCU such as ATTINY85 ot ATMEGA 88 as a USBISP; for those who does not have a programmer.
Connection between the breakout circuit and MCU is simple.
CH340G - MCU
CTS - MISO
VCC - VCC
RTS - SCK
DTR - MOSI
GND - GND
TXD - RESET
There is a pullup resistor between VCC and RESET.
You need to add following text to avrdude.conf file.
# serial TTL CH340G or PL2303
# reset=txd sck=rts mosi=dtr miso=cts
# wire pull up between VCC and RESET of AVR
programmer id = "serTTL";
desc = "serial TTL, reset=txd sck=rts mosi=dtr miso=cts";
type = serbb;
reset = ~3;
sck = ~7;
mosi = ~4;
miso = ~8;
Step 3: Using USB-serial Converter to Program AVR
If you have a USB-RS232 converter, you can use the above circuit to program AVR MCU.
For AVRDUDE, select ponyser programmer.