Hey gang I could use some help on my first custom PCB project. I'm trying to set up a 328p running an Arduino bootloader paired with a C340G for programming. It's also wired up to a XD2803 to control some pumps but I haven't gotten that far yet. I have gotten so far as to connect to the atmega using an ISP programmer and uploading first Blink through the ISP then uploading the bootloader, which reported a successful download. I thought I was ready to move onto attempting a download directly via USB but alas I was faced with a no response error message, I'm going to reply to this post with the exact error message shortly after posting. I have checked the connections between the CH340G and the 328p and everything seems to line up per the diagram. Since I have no idea why I did it, I did try removing the 1k pulldown resistor on the DTR pin of the CH340G but that has not helped my issue. I have ensured I have drivers for the CH340G and it shows up properly in Device Manager.
Using board 'uno' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Using core 'arduino' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Detecting libraries used...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\standard" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7\\sketch\\Blink.ino.cpp" -o nul
Generating function prototypes...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\standard" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7\\sketch\\Blink.ino.cpp" -o "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\standard" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7\\sketch\\Blink.ino.cpp" -o "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7\\sketch\\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\user\AppData\Local\Temp\arduino-core-cache\core_arduino_avr_uno_055c6788b55db887ecf291673cb8b693.a
Linking everything together...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7/Blink.ino.elf" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7\\sketch\\Blink.ino.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7/..\\arduino-core-cache\\core_arduino_avr_uno_055c6788b55db887ecf291673cb8b693.a" "-LC:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7" -lm
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7/Blink.ino.elf" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7/Blink.ino.eep"
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7/Blink.ino.elf" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7/Blink.ino.hex"
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\user\\AppData\\Local\\Temp\\arduino-sketch-4447E10EF01793C92026FCA30393F2A7/Blink.ino.elf"
Sketch uses 924 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM5" -b115200 -D "-Uflash:w:C:\Users\user\AppData\Local\Temp\arduino-sketch-4447E10EF01793C92026FCA30393F2A7/Blink.ino.hex:i"
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM5
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=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x69
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x69
avrdude done. Thank you.
Failed uploading: uploading error: exit status 1
Before going for a PCB You verify the entire build using bread board, proto boards etc.
Do You intend to make the PCB layout and etch it Yourself?
I considered self etching or milling with my CNC, and probably will try it in the future, but for this project I ordered these from JLCPCB. I know minimum viable circuit for the 328p is good since I've made those before in the breadboard and my preliminary testing with the transistor IC is good, but didn't have an adapter to test the CH340G with the 328p prior to fab.
Pins AVCC/AREF appear not to be connected in a conventional manner. Compare these with say an official Nano schematic.
330R for the pin13 led looks a bit strong but should not be the problem.
I suppose you could, over the ICSP header, try loading a simple sketch which writes to the serial console to test the CH340. You'll then need to reload the bootloader after that test.
Hmm you know I think you are on to something here. I think I put the decoupling cap on Pin 20 of the 328p but completely forgot to provide it 5VDC in the first place so I'm only powering one VCC pin. Not totally sure how the ISP downloaded Blink sketch still managed to work but it could be messing up timings internally making it fail to download through the CH340G. I'm going to try jumpering 5VDC over to it and see if that makes it work!
Failing that, great idea about the serial writes sourced from the 328p. That'll be the next step if the jumper fails.
Lose the pulldown resistor on DTR.
Other way around surely.......
Well I jumpered 5V over to the voltageless VCC and AREF. I also already tried removing the pulldown resistor and have left it out through all further testing. It's still failing to communicate with the CH340G since I did write a program that writes out a serial message and communications are failing to flow out as well as in. I'm having more problems with the transistor IC I am using even on a breadboard so it appears I need a V2 of this board anyway.
I exported Blink to a hex then loaded it in atmel studio and downloaded via ISP, then I uploaded via ISP programmer in Arduino, then flashed the bootloader and attempted to upload via USB. I wanted to verify that my 328p was functioning properly first.
ah...ok.
If you're having problems with the ch340, perhaps try it on a basic 2 bob arduino board to start with and make sure you have that proceedure correct first.
I have had it where even a change of usb socket on the pc will throw up errors and get cantankerous.
I think you have Tx and Rx reversed, at least in your schematic. In my Nano schematic, PD0 (D0) is connected to the TXD pin, pin 2, of the CH340G. It appears you have PD0 connected to pin 3 of the CH340G.
![]()
Son of a...yeah this is it. I reversed my RX and TX twice when I made the RX and TX net labels. I cut them off, jumpered, used an Uno to flash the bootloader and voila worked like a charm. Thanks everyone for your help! I need to make a V2 of the PCB anyway since I designed the transistor IC as a PNP transistor not an NPN so at least I only need to rework it one more time. Any assorted feedback since I need another manufacturing run anyway?
Publish your revised schematic here for review and indicate how you intend to switch the pumps. Usual is to switch these on the low side so the xd2803 looks to be a valid choice.
Here is my revised schematic. There are a few significant changes and one not so significant change. I also included my PCB layout as a bonus.
- Reversed RX and TX connections on the 328P so that now I only reverse them once between the CH340G and the 328p to get TX->RX and vice versa.
- Removed the pull down resistor on the DTR pin of the CH340G.
- Reversed the power flow of the pumps connected to CN1 and CN2.
- Added pump status indicator lights for effect/troubleshooting. I believe these will work as indicated though it's possible this will make it so that the XD2803 doesn't get sufficient current but I believe the XD2803 has an internal resistor of >1k ohm so it should be fine.
Yeah, for hobbyists like me, if the UART adapter doesn't work, the first thing you do is try switching Rx and Tx. It doesn't matter how sure you are you have them connected right. Just try switching them. It won't take long, and won't hurt anything. Save you a lot of time. Not for EEs of course, because they always have them connected correctly.
With modern efficient LEDs, I would think you could use a higher value than 330R. 1K should work fine, maybe even 2.2K.
Yeah lesson learned. Now that I've gotten through the hurdle of my first board, I imagine this is something that I am absolutely going to be refining and doing again. Hopefully next time I remember to try reversing my RX and TX first not last.
I'll see what resistors I have on hand and use a higher one of it makes sense then. 330R shouldn't hurt them right? Just more power efficient.
If you are using a 5V supply and red LEDs, then with 330R each GPIO will be sourcing about 10mA for the LED when it is on. That's within spec, but if there are cases when all the LEDs are on at the same time, then you are using about 40% of the maximum permitted Vcc current for the 328P. I don't know anything about your XD2803, but I suspect it will still work fine.
But there's really no reason to run more current through the LEDs than is needed for them to be clearly visisble. LEDs have current ratings, but those are maximums, not minimums, and for indicator LEDS, a small fraction of the maximum is usually enough. Of course it does depend on the LEDs. LED efficiency varies widely, but the newer ones are typically very efficient.
My understanding is each of the XD2803 drivers has an integrated 2.2kR resistors between the input pin and the NPN transistor. Sounds like I may run into issues since the intention is to drive up to 8 of these pins at any given time. I will probably have to do some testing, but it seems like if I increase the resistance of the resistors on those LED lines to 1 or 2.2k that will add an additional layer of protection.

