Sometimes making your own tools or development hardware can be very satisfying and rewarding, even if it ends up not being the cheapest or easiest solution. This also served as my first real practice of solder paste stenciling and hotplate reflow. https://www.youtube.com/watch?v=OORJHGpt7dw
You only need an ICSP programmer like the USBasp (or you can make one out of a spare arduino uno/nano) if your chip is blank. The atmega will only work with serial programmers like the CH340 if the bootloader has already been burnt to the atmega. The bootloader is necessary for the atmega to know how to listen to the CH340 and program itself over the gpio serial interface. Otherwise, on a blank chip you must program it over the native ICSP interface (which the CH340 isn't capable of speaking).
I'm having a real hard time with these CH340C chips. I have a 'tape' of 10 of them which I bought from Aliexpress. Out of the 10, I have only managed to find one that will work fine. I soldered it to a SOP-16 breadboard adapter PCB and Windows picks it up no problem.
The other 9... nope. One doesn't do anything at all, and the others all say that Windows doesn't recognise the device. I have my iron set to 360 C. Am I soldering these too hot or are they just dodgy low QA chips from Aliexpress? Makes not sense to me at all. Why one out of 10 keeps working fine and the others don't..
I honestly dont trust aliexpress for anything but passives. I doubt you cooked them to death, I've definitely reflow heated mine at even higher temps and they work fine. I got like 30 ch340c's for dirt cheap off jlcpcb's sister part supplier site lcsc. I'd suggest getting a bunch of other parts you may need at the same time to make the shipping cost worth it.
Thanks for that! I didn't even think about ordering from LCSC - that's a great idea! I use JLCPCB all the time. On a positive note, I knocked up a test circuit with one of the CH340G's that I bought and that worked straight away. Thankfully Aliexpress refunded the CH340Cs but its the time its wastes that annoys me the most. I'm going to knock up a new PCB to take both devices.. and fix the silly reset mistake that I made. Now that I know that it isn't my soldering, I might remove the 2560's from the dodgy assembled PCBs that I paid for and have a go at soldering them myself on the new boards when they arrive.
I've had a go at making my own.. I pretty much duplicated the schematic here: https://cdn.hackaday.io/images/8630341696450413328.png
I plug the USB cable into my PC and unlike a typical Arduino ATMega2560 board, the Windows Device Manager doesn't even twitch. My power LED is lit but no new devices are found. Windows should detect the CH340G as soon as it's plugged in shouldn't it?
I don't see any activity on my TX/RX leds either.
VCC is +5V. I have no connection to the 3V3 pin of the CH340G
Did you burn the bootloader via an icsp programmer? Most bare chips come blank without the bootloader or proper fuses set. Also double check that you've preinstalled the zidag drivers for the ch340. And last but not least the ch340g requires a 12mhz crystal but the ch340c does not, double check the version you are using and if you require the crystal or not.
No, I had the ATMega2560 and CH340G assembled for me on my PCB so I didn't even think I'd need to flash anything. I'm also using a 16MHz crystal.
I've only tried plugging the device into my work PC so far (which won't have the Zadig drivers) but I'll give my own home PC a go later. I have the feeling I had to install the Zadig drivers while playing with a Pi Pico or ESP32 - can't remember.
@sjm4306 On this schematic, XI and XO are not connected to anything - so there's nothing actually clocking the CH340G. I wonder if the CH340C is pin compatible? Maybe I can hot air the CH340G and replace with a CH340G instead?
I'd like to do something similar myself - I have a rats nest of wires hanging out of my ATMega2560 and I'd like to make a board of my own with an angled header that will connect directly to one of my other boards without the unreliable wires.
I thought I'd try importing the schematic into EasyEDA (which I use all the time with JLCPCB) but it wouldn't read the Eagle .sch file. Maybe I'll be able to import into Kicad and Export back out? I only have freebie KiCad.
Of course I could just knock up my own schematic if I can find time :-) Looks pretty simple really so should be able to find time for that.
Do we actually need a USBasp programmer to program an ATMega2560 or is the CH340 enough to allow the likes of the Arduino IDE to program the device?