I've been working on a version of Universal programming shield, that can be used to upload code to Arduino UNO, Nano, Attiny-85/84(Dip versions). I have a prototype built already. The shield has a DC Power jack and a USB-C connector, however, the actual programming has to be done using the USB port of the Arduino Uno/Nano. Basically, the USB-C on the shield only works for Powering the devices.
I've been trying to breadboard a circuit, using a CH340G breakout board to upload code to an Arduino UNO/Nano. I've followed every single instruction on tutorials available online. However, I cannot get it to work. I keep getting the "avrdude: stk500_getsync(): not in sync: resp=0x00" error.
I've tried changing the board type, the programmer etc.
I do have to specify. The Arduino UNO I am trying to program already has an ATMega16U2 onboard as a USB to TTL driver.
I intend to Bypass this by connecting my CH340G breakout to the 5V, GND, TX, RX and Reset pins.
And Yes, I tried swapping the TX and RX connections as well.
Not sure what I am doing wrong here. Any help will be appreciated.
Thanks.
P.S: I've already installed the CH340 drivers and verified that it's working fine. I've tried shorting the TX and RX pins on the breakout board and see the messages going through on the Serial Monitor in Arduino IDE. Also, I've used the Breakout board to upload code to an ESP32 Cam and it worked without any issues.
Update: Below is the wiring I am following. The Arduino uno I have is an Elegoo brand, has an ATMega16U2 as the USB to TTL driver on it. The CH340G adapter is a generic one I bought off of Amazon. All I am trying to do is, to upload a blink sketch to the Arduino using the CH340G adapter. Nothing fancy, just bypass the onboard USB on the Arduino Uno.
Put a 100nf capacitor in your DTR to reset path. The reset pin goes to the reset on the chip. The DTR is a constant level, but you need a pulse on the reset pin.
@oldcurmudgeon: First off. Thanks for the advice. It almost worked.
A Few things, that didn't work
I tried adding a 100nf Ceramic in series from the DTR pin to the Reset pin on Uno.
Tried adding an Electrolytic in series.
Tried adding an Electrolytic Cap from Reset on Uno to Ground.
However, disconnected the DTR pin, and pulsed the Reset button on Uno, after compilation. That worked. Barely. The timing of the pulse needs to be precise or else it goes into the "out of Sync" loop again.
So, out of curiosity, measured the voltages at Reset pin and the DTR pin.
Reset Pin on Uno is Normally High. Goes low when Reset button is pressed.
DTR Pin on CH340G is Normally high. Goes Low when Uploading code, but doesn't go back to High, until either the code is uploaded successfully or the upload fails. I believe this is what you mean by
Again. Not sure what I am doing wrong. Is there a specific type of cap I need to use. or is it something with 100nf? So many questions.
Well I'll be damned. Finally got it to work. Didn't wanna work with a Ceramic Cap. But I happened to have a bunch of Electrolytic 0.1uF Caps and Voila.
Trick was to get the polarity right. Positive end of the Electrolytic Cap to the Reset Pin on UNO and negative end to the DTR Pin on the Adapter.
Works like a peach..!!
@oldcurmudgeon: Thanks for the inputs bro. You saved me from a world of pain.