avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avrdude-dev] Reset function for arduino


From: Josef Wolf
Subject: Re: [avrdude-dev] Reset function for arduino
Date: Tue, 24 Aug 2010 20:53:09 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Aug 24, 2010 at 05:17:39PM +0200, Josef Wolf wrote:
> The reset function for the arduino board seems not to be quite correct, IMHO.
> 
> The arduino_open() function, as implemented, leaves the *DTR and *RTS lines on
> the TTL side in low level, causing the board to be in reset state permanently
> if the board contains only the resistor without a capacitor (for example
> arduino NG or Diecimila)
> 
>   http://arduino.cc/en/uploads/Main/arduino_NG_schematic.png
>   http://arduino.cc/en/uploads/Main/Arduino-Diecimila-schematic.pdf
> 
> I would suggest to let the *RTS and *DTR lines go to high again after reset,
> so the chip can actually run regardless whether there is a capacitor or a
> resistor used to attach to the *RESET input.
> 
> The attached patch works for me with both types of boards, no matter
> whether a resistor is used or a capacitor.

I get much more reliable results when I shorten the reset pulse to 50us.

With a pulse width of more than 3*1000us, the upload procedure gets very
unreliable. That's probably because the charge curve starts rising quite
fast and (in the worst case) 0.2Vcc (that is, 1V when Vcc==5V) is enough
to end the reset cycle. Thus, the chip can start running long before the
50*1000us have passed.

The data sheet says 2.5us is the minimum pulse width, so 50us should have
enough reserve to accomplish for USB delays.

Below is the updated patch. Please comment.

Index: avrdude/arduino.c
===================================================================
--- avrdude/arduino.c   (Revision 947)
+++ avrdude/arduino.c   (Arbeitskopie)
@@ -92,10 +92,17 @@
    * (for example in Arduino) */
   serial_set_dtr_rts(&pgm->fd, 0);
   usleep(50*1000);
-  /* Set DTR and RTS back to high */
+
+  /* Set DTR and RTS back to high to assert RESET */
   serial_set_dtr_rts(&pgm->fd, 1);
-  usleep(50*1000);
+  usleep(50);
 
+  /* Clear DTR and RTS again, so the chip can run even when a resistor is
+     used instead of a capacitor
+  */
+  serial_set_dtr_rts(&pgm->fd, 0);
+  usleep(50);
+
   /*
    * drain any extraneous input
    */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]