I have a PCBa for programming many ICs, that I made. I can't seem to program the ICs though. I can connect to the programmer via USB though. Here is the schematic:
If you draw the lines from the CH340 pin2, follow the bus labeled RX, it's connected to pin 26 of the CP2102.
In other words, TXd to TXd. I don't think this is what you intended.
The CH340 and the CP2102 are the on;y IC's that I see RX and TX wire labels.
The RX and TX go through a DIP switch to the lower Atmega328. The CP2101 and CH340 are just two different programmers on the same board for the same thing. But I never managed to successfully solder on a QFN-20. I only managed to destroy the pads and the IC from soldering it on badly and then not being able to get it back off. So pretend the CP2102 is non-existent.
Also, I did add a wire from the CH340’s DTR to the Atmega’ s RST. But, it didn’t seem to work. The Atmega would reset when I press the upload button, but the program wouldn’t upload and the RST button didn’t do anything. It was as if the RST was stuck low. So, I cut that wire and tried again by pressing the RST button immediately before uploading and it worked! Any suggestions on how to have the CH340 do that?
I still haven’t managed to get the the Atmega16 programmed though. I just keep getting the response of the address being 0x000000. The Atmega16 is really the only IC I need to program.
The DTR signal from the CH340 goes low and stays low during your entire serial session. So, like you observed RST was stuck low. That is the expected behavior of connecting DTR to RST. You can convert DTR into a momentary pulse low to reset the ATMEGA if you send the signal through a 100nF capacitor. The CP2102 has one of those on its DTR pin.
I agree with aarg, you really need to improve that schematic. There may be other problems with your design. I don't know about running the crystal signals through a dip switch. The crystal should be as close as physically possible to the MCU they are for, with shortest traces or wires as possible and no extra components that could introduce more capacitance and points of failure. I usually like to prototype complex circuits like this on a breadboard, that way I won't be testing that the circuit will work after designing a PCB and doing a bunch of soldering.
I'll try out the 100nF cap from the CH340's DTR to the Atmega's RST later. I'll also try soldering a 16MHz crystal and two 22pf caps directly onto the atmega16's socket and see if that works.
To me, it sounds like a crystal error. I made this PCBa / circuit a while ago so I agree the schematic and some of the ideas are quite ugly / faulty.
Yes. It is on the RST button on the bottom left of the schematic.
It works! The Atmega328 resets automatically when programming and I am able to program my Atmega16. The problem was I accidentally soldered on the socket backwards. So I was placing the IC backwards. That is a stupid issue. Thanks everyone for your help! And thanks @dmjlambert for your explanation of the DTR with the CH340!