Hi, I designed a PCB with Atmega328 and CH340G to be able to upload a program via USB cable without USBasp or another programmer. I solder everything, upload a bootloader and a blink (by a programmer) and it works just fine, I tested the functionality of the board and it works just fine. But there is one problem, I can't upload a program via USB cable. When I plug it to my computer I see a COM3 in Arduino IDE when I try to upload I got an error message:
Using Port : COM3
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xf5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xf5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xf5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xf5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xf5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xf5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xf5
You can find fragments of my schematic in the attachments.
I don't know why it doesn't work but I am also not sure if my connection of CH340G is good.
Any help highly appreciated!
Here is full schematic. I am quite experienced in all of that, doing it for over 4 years now. There is no problem with RX and TX, take a look at how those are connected to CH340G. I also checked that with a multimeter and all the connections are fine. So there must be a mistake in my schematic, when I was designing this PCB I was afraid about using CH340G because it isn't well documented, but that was the only way for me to make it programmable without a programmer.
Thanks
Please make your images visible in your Reply. See this Simple Image Guide
Can you upload a short program direct to the Atmega 328 (i.e. without using the CH340G) and which communicates with the PC using Serial. If so, can you read the output in a terminal program on your PC?
Do you have any other Arduino board that successfully uses a CH340G?
Do you have a USB-TTL cable that you can use for uploading code? Can you upload to your new board with that?
There is an LED on pin 5 so that I can see what is going on. Once I open serial monitor LED stops blinking and I can't see anything on the serial monitor. Don't really know why.
To check if it works I soldered two cables to the R2 and R3 on my PCB and connect them to external USB to UART converter and it works fine, I can see the output on the serial monitor, LED is blinking program is running without any problems. Maybe there is a problem with reset connection to the CH340G.
I don't have any other project of mine that use CH340G that's the first time I tried it, and I hope to get it working or at least learn my mistakes and use in my next projects. How about capacitors and resistors that are connected to CH340G are they ok? And how about resistors between Atmega and CH340G?Thank you
so much easier when we can see the complete picture. yeah looks like the cap is there to block dc to CH340 Pin 13 (DTR). Hope you didn't burn out that pin.
TomGeorge:
Hi,
Shouldn't there be a cap connection between pin 13 on the CH340 and the 328 Reset Pin?
Tom...
Yup, what he said. You missed the 100nf cap in series from the DTR line to the reset pin.
You must use a capacitor because the serial port drivers hold DTR low during transmission time. Without the cap, the '328 is held in reset by DTR for the duration, preventing download. With the cap, you get a reset pulse on the falling edge of DTR going low which wakes up the bootloader, it syncs with AVRDUDE and you get your download.
Hi,
Sorry, but if this circuit was drawn properly with wires connecting pins it would have be plain to see, these "search a word" diagrams are okay to produce a PCB, but hopeless when it comes to circuit analysis;
[soapbox] The problem with "search a word" is you see a pin that is labelled say "RESET" then you have to "search a word" to find what it is connected to.
The biggest flaw. it doesn't tell you how many points "RESET" is connected to.
Hence "SEARCH A WORD", yes nice and tidy diagram but bloody hopeless at trouble shooting, as has just been demonstrated. [/soapbox].
I agree the schematic is small enough to have had all the interconnects shown but... The netlist in KiCad would have been correct and hence the pcb layout correct, the goal of the tool's usage.
I guess I've adjusted to schematics having been drawn in this way that I don't even give it a second thought about what is really a fair amount of missing detail. Some would call it progress. Some would call it laziness. Some would call it sloppy practices. I'm not sure what I would call it as I think what was originally good intentions toward simplification for complex schematics is never without unintended consequences.
What's the old adage? Never let a good deed go unpunished?