3

I'm trying to understand the auto reset process and why a capacitor hooked up between DTR and Reset works so I ran it through my logic analyzer and I'm seeing the chip reset three times during the programming process. Does anyone know why it's done three times and not just once?

You can see in the picture the top pin is the DTR and the bottom two are attached to reset (digital/analog). When DTR drops low the reset pin does too for between 200-500us but it does it three times in around 1 second.

Auto Reset

2

It does it to "force" a reset.

Historically, when you open the serial port on an FTDI interface, the DTR will automatically go LOW. However, recently FTDI decided it'd be a good idea to change their driver so that when you open the port the DTR line doesn't go low - you have to manually tell it to go low. But this is only on the FTDI official drivers.

If you have a driver that is newer than a certain date (no idea what date) then just running avrdude by itself on an FTDI interface may not work properly since DTR isn't being lowered.

To get around that Arduino have included a forced toggling of the DTR line as part of the programming sequence to make the target board reset.

But of course, if the driver is old enough, or not the "official" FTDI driver (i.e., you're in Linux for instance) then the lowering of the DTR by avrdude works fine.

So what you are seeing there is first a brief toggle of DTR by the IDE to force a reset, then avrdude opening the port and DTR going low, then finally the IDE toggling DTR again one last time to force a final reset.

And to me that says you're either not in Windows, or you have an FTDI driver while does toggle the DTR line automatically.

I also have a feeling that avrdude may also have started including manual control of the DTR line within it - so if avrdude is new enough, even with a new FTDI driver that doesn't automatically, you will still see the repeated action of DTR.

It's what we call belt and braces. Use every method possible to get the board to reset, so no matter what you hardware and software arrangement the board has a very good chance of being reset into the bootloader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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