Arduino as ISP - the capacitor

When I use a Nano as the ISP to flash the bootloader to a Pro Mini, I have to install a capacitor to ground on the Nano's reset pin. Otherwise it doesn't work in my IDE v1.8.8. Are there circumstances under which the capacitor would not be needed?

Do I just need to use a later IDE version? If so, what's the last version which required the cap?

Could I select a different programmer in the IDE which would not require the cap?

Thanks for any clarification.

Yes.
Simply cut the track leading to the reset line, and then put a switch on the board that can short out that cut for normal, that is none programming, use.

This is what it looks like on my Arduino Uno.

There is a solder link on the under side of the board that I had to cut as well. This slider just shorts out the solder link I cut, for normal operation.

3 Likes

Ok, thanks very much. It's just that I've seen tutorials that go through the process without any mention of the capacitor, and I wondered if v2 of the IDE provided an ArduinoISP.ino example that got around the reset issue in some way. But it seems the cap is still needed for any programmer Arduino that uses USB.

So @Grumpy_Mike, you have a dedicated Arduino programmer. That switch is pretty neat.

1 Like

Hi @ShermanP.

There is a connection between the version of the "Arduino AVR Boards" platform and the need for the capacitor. A change was made in version 1.6.22 of the platform that made it more likely that the capacitor would be needed:

The change was later reverted in version 1.8.1 of the platform.

The version of the "Arduino AVR Boards" platform is loosely correlated with the Arduino IDE 1.x version because the platform is bundled with the Arduino IDE installation. The problematic platform versions were bundled with Arduino IDE 1.8.6-1.8.9.

However, thanks to the Arduino IDE Boards Manager, it is possible to use any version of the "Arduino AVR Boards" platform with any version of Arduino IDE. So it is possible that you have updated your "Arduino AVR Boards" platform installation to a recent version that doesn't have the problematic configuration. You can check by opening Boards Manager and then looking to see which version of "Arduino AVR Boards" it shows as being installed.

As was already mentioned, this is only needed when the programmer board has an auto-reset circuit, which the native USB boards (e.g., Leonardo) don't have, and which can be disabled even on boards that do have one as @Grumpy_Mike explained.

However, I find that with some hardware configurations I need one, and with others I don't even though the programmer board has a functional auto-reset circuit.

Thanks very much. So I've been using v1.8.8, and find that I always need the capacitor. The Boards version is 1.6.23.

But it gets more complicated. I'm a new convert to using AVRdudess, which is a front end GUI for AVRdude. The latest version of dudess brings with it the latest version of dude, and of course the IDE is not involved at all. And I find that I still need the capacitor. So, not to doubt you or anything, but my conclusion is that 328P Arduinos with DTR resets will always need the capacitor regarless of IDE version, Boards version, or AVRdude version.

Unless you have some specific reason to use that version, I recommend you use Boards Manager to update it to the latest version 1.8.6. Even if it doesn't eliminate the need for the capacitor for you, surely some other beneficial fixes or enhancements have been made since the time of the outdated version you are using.

There is no significance to that observation. Arduino IDE just invokes an avrdude command. You can see the command if you enable the verbose output during upload option in the IDE preferences and then perform a "Burn Bootloader" operation. There is no difference between the IDE invoking that command, Avrdudess invoking the command, or you invoking it directly from the terminal.

Your conclusion is incorrect. I know from personal experience that it is often not required. If you do a quick search on the Internet, you will find many examples of people successfully using an ATmega328P-based board as an Arduino as ISP programmer without connecting a capacitor.

In fact, just minutes ago I successfully used an unmodified classic Nano as an Arduino as ISP programmer without connecting a capacitor to it.

Well then I'm completely confused. If the IDE just calls AVRdude, then what difference does the IDE version or the Boards version make? Is the AVRdude command line different?

I don't have an unmodified classic Nano, only a clone. Does that matter? What IDE version, etc., did you use that didn't require a capacitor?

Yes, I do see that. That's why I started the thread - figure out why they don't need the capacitor, but I do. What's different between them and me?

Yes. The template for the command that is invoked is defined by the platform configuration files.

Not for me. I just did it again with a cheap Chinese Nano clone as an Arduino as ISP programmer (I used an official Nano for the previous experiment) and was able to perform a "Burn Bootloader" successfully without connecting the capacitor.

Well, for one thing you are using the antiquated version of Arduino AVR Boards that specifies the use of the arduino protocol instead of the more appropriate stk500v1 protocol in the avrdude command, which makes the capacitor necessary.

As your your result when using Avrdudess, I don't have any experience using it, but it is possible that it also uses the arduino protocol. If it allows you to see the avrdude command it invokes, you can check it. The command should contain a flag like -cstk500v1 instead of -carduino.

AVRdudess does show me the command line, and when I select arduino-as-isp as the programmer, and install the capacitor, I get this:

Reading fuses...
>>>: avrdude.exe -c arduino_as_isp -p m328p -P COM3 -U hfuse:r:-:h -U lfuse:r:-:h -U efuse:r:-:h 
SUCCESS: Read high fuse
SUCCESS: Read low fuse
SUCCESS: Read extended fuse

But when I change the programmer to stk500v1, then with or without the capacitor, I get this:

>>>: avrdude.exe -c stk500v1 -p m328p -P COM3 -U hfuse:r:-:h -U lfuse:r:-:h -U efuse:r:-:h 
ERROR: Unable to read fuses/lock bits

Error: programmer is not responding
Warning: attempt 1 of 10: not in sync: resp=0x00
Warning: attempt 2 of 10: not in sync: resp=0xe0
Warning: attempt 3 of 10: not in sync: resp=0xe0
Warning: attempt 4 of 10: not in sync: resp=0xe0
Warning: attempt 5 of 10: not in sync: resp=0x00
Warning: attempt 6 of 10: not in sync: resp=0xe0
Warning: attempt 7 of 10: not in sync: resp=0xe0
Warning: attempt 8 of 10: not in sync: resp=0xe0
Warning: attempt 9 of 10: not in sync: resp=0x00
Warning: attempt 10 of 10: not in sync: resp=0xe0
Error: unable to open port COM3 for programmer stk500v1

Avrdude done.  Thank you.

So something else must be involved. Could you possibly provide the exact full command line that works without a capacitor on a clone Nano as the programmer?

I'm sorry to belabor this, but I really would like to find out exactly what makes the capacitor needed or not. I just posted a project on Github that requires setting the BOD level down to 1.8V on a 8MHz Pro Mini, and gave instructions on how to modify the extended fuse byte in AVRdudess, including installing the capacitor. I'd just like to know whether I'm giving correct instructions or not.

It seems to me that either the AVRdude command line is different, or the code in the ArduinoISO.ino example is different, or both.

Edit: I just flashed my Nano with the ArduinoISP.ino example from IDE v1.8.18, and the results are the same as before for Arduino-as-ISP and stk500v1. The only thing that works is Arduino-as-ISP with the capacitor. So unless the example has changed in IDE v2, we're back to the command line.

Edit 2: I guess the other possibility is the USB-to-COM driver is different. I don't know how to test that.

The "Burn Bootloader" command actually invokes two avrdude commands in sequence. These are the commands that are produced using Arduino AVR Boards 1.8.6 to perform a "Burn Bootloader" operation while Tools > Board > Arduino AVR Boards > Arduino Uno is selected from the Arduino IDE menus:

The first command sets the fuses:

"C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega328p -cstk500v1 -PCOM17 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m

The second command writes the bootloader binary:

"C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega328p -cstk500v1 -PCOM17 -b19200 "-Uflash:w:C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/optiboot/optiboot_atmega328.hex:i" -Ulock:w:0x0F:m

But you do not need me to provide this for you. You can get it yourself (with the appropriate paths for your system) by doing this:

  1. Select Tools > Board > Boards Manager... from the Arduino IDE menus.
    The "Boards Manager" dialog will open.
  2. Wait for the updates to finish, as shown by the messages printed at the bottom of the "Boards Manager" dialog.
  3. Scroll down through the list of boards platforms until you find the "Arduino AVR Boards" entry. Click on it.
    Some buttons will appear on the entry.
  4. Click the "Update" button on the "Arduino AVR Boards" entry.
  5. Wait for the update to finish.
  6. Click the "Close" button on the "Boards Manager" dialog.
    The "Boards Manager" dialog will close.
  7. Select File > Preferences... (or Arduino > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  8. Uncheck the box next to Show verbose output during: compilation in the "Preferences" dialog.
  9. Check the box next to Show verbose output during: ☐ upload.
  10. Click the "OK" button.
    The "Preferences" dialog will close.
  11. Attempt a "Burn Bootloader" operation, as you did before.

After the "Burn Bootloader" operation finishes (regardless of whether it passes or fails), examine the contents of the black output panel at the bottom of the Arduino IDE window. There you will find the avrdude command(s) that Arduino IDE invoked. You can run that same command from the terminal if you like.

1 Like

Ok, I downloaded IDE v1.8.19 as portable, did the boards update to 1.8.6, and tried to burn the bootloader. Verbose uploading output gives the same AVRdude command line as you have, including using stk500v1 as the programmer.

C:\arduino-1.8.19\portable\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\arduino-1.8.19\portable\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM3 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m 

But it errors out without the capacitor. With the capacitor, it works fine. In fact, I tested it before upgrading the boards (they were v1.8.3), and it behaved the same. It works fine as long as the capacitor is there.

So maybe your Chinese Nano clone is different from my Chinese Nano clone.

Or you know, it could be different USB drivers, or if you're using IDE v2.x.x, AVRdude.conf could be different. I just don't know.

By the way, AVRdudess does not work with STK500v1, even with the capacitor present. But it has a later version of AVRdude, and an AVRdude.conf file almost twice as big as the one in 1.8.19. So it's not at all the same. But it has a specific entry for Arduino-as-ISP in the conf file.

Any possibility the different results could come from CH340 USB-Serial Chip vs FTDI USB-Serial Chip ?

The avrdude.conf file is bundled with the installation of the arduino:avrdude@6.3.0-arduino17 tool dependency of the Arduino AVR Boards 1.8.6 platform. So everyone using Arduino AVR Boards 1.8.6 is using an identical avrdude.conf file (unless they manually edited that file).

Yeah, I noticed that in the command line you shared it uses the arduino_as_isp protocol:

I don't have much experience using the newer versions of AVRDUDE and haven't looked to see what the difference is between that protocol and the arduino and stk500v1 protocols used by the Arduino AVR Boards command templates.

Yes it could. Both the chips and their drivers. Or even different versions of the same driver.

I might be able to test that by using my FTDI adapter with the Pro Mini as programmer to burn the bootloader to another Pro Mini or the Nano. If that worked without a capacitor, that might narrow things down. But somehow I'm doubting it's going to be that easy.

Anyway, for now I think my directions in my repo for using AVRdudess are valid - use a capacitor.

Note that I have successfully used both the official classic Nano (which has the FTDI FT232R) and a cheap Chinese Nano derivative (which has the WCH CH340) as "Arduino as ISP" programmers without the capacitor.

But as @ShermanP says, the driver versions might be a factor.

Excuse my ignorance, but is v1.8.6 also used in IDE v2? And for that matter, are you using IDE v2 when it works for you in tests without a capacitor?

Well, I really appreciate your trying to work this out for me.

Yes, if you want to provide a single set of instructions that will work for everyone, specifying the use of the capacitor will be appropriate.

At least for the support work we do here on the forum, the problem with that in the majority of cases where we are instructing a user in the use of an "Arduino as ISP" programmer (to try to recover a board that can't be uploaded to), the user doesn't have a capacitor on hand and will find it inconvenient to procure one. So in that case it is worth trying first without the capacitor before resorting to adding the capacitor if the procedure fails with the error message that indicates it failed due to the programmer being reset.