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!

user69795
  • 206
  • 2
  • 4

2 Answers2

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

PimV
  • 443
  • 1
  • 4
  • 12
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.

user69795
  • 206
  • 2
  • 4