how to make a DTR reset?

usually,when we connect our board with USB cable,the arduino board will take a automaticlly RESET.
that's mean,when the serial port is connected,and port is ready,the USB2Serial chip,such as CP2102,will pull low the DTR pin,the arduino board just use this feature to download the sketchs.

recently, for some personal usage,i have made a tool,just call it "Xload', to upload the *.hex file,which is compiled by the arduino IDE,instead of arduino IDE.

it is almost successful,but it can't upload for the second time,if you don't close the program.because it can't reset the MCU. i just disable the serial port then enable it,Xload can download the hex file to the chip successful,run normally.

does anyone know the schematic of when and how the DTR signal generated by the usb2serail chips,such as cp2102?

The tool just made for Mega2560 recent now,when solved the problem above,i will support to the other chips soon.

xload.JPG

Neat tool.

When interfacing with existing hardware with DTR reset circuit, all you need to do is close and reopen the serial connection - also, there is probably a way to manually twiddle the DTR pin (see the documentation for the serial library in whatever language you're writing that in).

On the hardware side, the DTR pin is connected to one side of a 0.1uf ceramic capacitor. The other side of that 0.1uf ceramic capacitor is connected to the RST pin on the AVR, and pulled up with a 10k resistor to Vcc.

Thus, when DTR goes low and stays low, the RST pin initially goes low, but is then quickly pulled back up by the resistor. When DTR goes high again, that's okay, because the RST pin is rated for up to 12v.

Some people put a diode from RST to Vcc (with the band towards Vcc) to prevent reset from rising above Vcc - on the unproven theory that some otherwise unexplained brickings were caused by briefly entering HVSP mode).

2 Likes

Thanks DrAzzy

actually i know the reset logic on the AVR side,but when the DTR output a low pulse is a little confuse.

your advise "whatever language you're writing that in" is the reason.when i add the DTR control code,it's OK!!! and i add a little more delay between close the reopen the serial port,it's also make sense!

thank you.

Why not simply use avrdude, just like the IDE does? A simple batch file to run avrdude will do the upload...

Regards,
Ray L.

RayLivingston:
Why not simply use avrdude, just like the IDE does? A simple batch file to run avrdude will do the upload...

Regards,
Ray L.

how to build the enviroment with avrdude?
i just now do a research on the sketch upgrade,espicially in wireless way.my clients need it,because the board is far away to get.

is there any exsting tools to fit my and my client's need?