5

When an Arduino Uno is powered on, the USB chip's DTR output pin may (is, in fact) low for a while. This means that the capacitor C5 is connected from the 328p reset pin to ground. Thus, when power is applied, the reset pin is held low for 10's of milliseconds after power up (while C5 charges) .

Thus, when the 328p starts, the reason for reset (the MCU register) always is "external reset", not "power on reset", even when power turns on.

This can be fixed by removing C5, or opening the "reset en" jumper, but then the chip is never reset by the falling of DTR,...that is, bootloading is disabled.

Is there a solution that allows POR and external reset for the bootloader? Thanks!

  • 1
    Don't use an Arduino with a '328p. – Majenko Dec 10 '18 at 0:04
  • The problem is not the 328p, but the DTR associated reset circuit. If for example, the USB chip powered up with its pins HIGH , the capacitor would not have to charge on power up. Unfortunately, it looks as though the USB chip on the Uno powers up with its DTR pin low or tri-stated. This causes the 328p to report that it received an "external reset", even on power up. – user69795 Dec 11 '18 at 15:02
  • 1
    I know what the problem is. And the answer is to use an Arduino that doesn't use that chip. Choose one with an ATMega32U4. It doesn't have the DTR reset system. – Majenko Dec 11 '18 at 16:07
  • I connect a 2n2222 with gnd pin and with res pin.. then if send 5v or HIGH pin from any pin by 1k resister arduino restarts... – user58927 Aug 19 at 10:43
  • User 58927: and in this way, you can reset the chip with an output command. However, the question is about the reset at power on of the Arduino being seen by chip as an “external reset”, rather than a “power on reset”. – user69795 Aug 20 at 23:15
2

See 'DTR-reset' circuit of Arduino Uno below.

After powering-on, when DTR is set low (because a sketch is coming in) the falling edge causes a negative pulse on the 328P's external reset pin of ca. 3 ms (see here). The width of this reset pulse is independent of the time that DTR stays low.

During powering-on the 328P's reset pin is low until the capacitor C5 is sufficiently charged. How long this takes depends mainly on the start-up behavior of Vcc. When DTR is low the capacitor will charge faster because RN2D (from capacitor C5 to ground) is bypassed.

But the main thing is that the power-on reset and the external reset have the same effect (see datasheet): when the rising voltage passes a certain threshold a timer is started and after it times out program execution starts at 0x0000 or at the Boot Reset Address (depending on the setting of the fuses). So, in the powering-on situation it makes no sense to differentiate between Power On Reset and External Reset.

DTR-reset circuit of Arduino Uno

  • Thank you for your answer. However, there is a reason to differentiate between Power on Reset and External Reset. The Optiboot bootloader for Arduino will start the user immediately on POR. On External reset, it will wait and look for bootloading data from the serial port. Thus, with the current Arduino UNO hardware, this feature of "instant start" in the bootloader cannot be used. – user69795 Dec 11 '18 at 14:56
2

I have answered my own question.
I added a pull-UP resistor on the DTR line to VCC. Now capacitor C5 does not need to be charged up on power up: both sides of the capacitor start at VCC. Thus, the 328p recognizes a power-up as a "power-up reset", instead of an "external reset", and my sketch starts after 75-milliseconds or so on power up. Basically, my circuit is like PimV's diagram, but with the resistor RN2D to VCC, rather than to ground. At least for the Uno, this fix seems to work. I suspect this relies on the USB chip (mega16u) being in reset, and it's pins tri-stated, for a while after power up.

protected by VE7JRO Aug 19 at 14:11

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.