Tuesday, 24 April 2018

How does the Arduino Deumilanove Auto-Reset Function work?


I'd like to hear some explanations as to how the Arduino Duemilanove resets the ATMega328P over USB through the FTDI FT232R transceiver.


I know it involves the IDE playing some games with the DTR serial handshaking signal. After looking at the schematics, what I'm really interested in getting a better handle on is how the circuit works:


        100nF           10kOhm
DTR -----||------+------^v^v^----- VCC
|
+--/RESET


The 10k resistor is the usual pull-up on the reset line. So what does the capacitor accomplish in this circuit?


As a sidenote, I used this as an excuse to try and learn/use LTSPICE, so I'm no pro at this tool. I modeled it in LTSPICE as follows, but it looks to me like the /RESET signal just matches the DTR signal exactly, which doesn't really make sense to me. I modeled the DTR signal as a Pulse Voltage source, maybe that's the wrong model. Is it the nature of the FTDI's DTR driver (e.g. perhaps it's open collector) or the internals of the /RESET pin on the MCU that are not present in the circuit I've drawn that make this all hang together electrically?


alt text


Also, here are some of the relevant links to datasheets and schematics for reference.




Answer



IIRC the cap is wired to /RTS not DTR.


When /RTS is high there is 0V across the cap. When /RTS goes low the cap can not change voltage instantaneously so the reset line goes low. The cap charges through the 10K resistor. Once the reset line is above the reset threshold the uC program starts.


@LouisDavis referenced this page, which states




The ATmega168 is reset by pulsing its reset pin to GND. ...by setting the DTR line to LOW ... the reset pin gets sucked to LOW until the capacitor is charged through the internal pull up resistor and R1 - which resets the chip.



Simulated:


Auto-Reset
VDTR 1 0 PWL(0 5 0.5m 5 0.000500004 0 1m 0)
Vcc 3 0 5
C1 1 2 100n
R1 3 2 10k
.control

delete all
tran 10n 5m
plot v(1) v(2)
.endc
.END

V(1) is DTR or /RTS and V(2) is /RESET
alt text


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...