Use reset pin as I/O pin

Hello, while studying the manual for the ATMega 328 I found on page 3 the information that the reset pin PC6 can be set to act as a digital I/O pin by programming the RSTDISBL Fuse. That would be very handy for me. Has anyone here ever tried this before? I never programmed a fuse before, how do I do that? Do I have to flash the bootloader?

The fuses are set as part of the Burn Bootloader process so that's probably the easiest way. The fuse settings are in the boards.txt file.

Be warned that if you disable the Reset pin to use it as an I/O pin you won't be able to use the bootloader to upload sketches. I think you will not even be able to use an ISP to upload sketches. You will probably need a High Voltage Parallel Programmer to program a chip with a disabled reset.

It works great as long as you make sure to flash it before you burn the fuse, and as long as your program doesn't have any errors. Or if your chips are cheap enough that you can afford to drop them in the "to be reclaimed someday" jar if you make a mistake. When you get enough of them, you can reclaim them with a high voltage burner. High voltage is relative. The cheapest high voltage rescue board I have seen for sale is here:

http://mightyohm.com/blog/products/hv-rescue-shield-2-x/

+1 TanHadron Bookmarked !!

Can’t you do high voltage programming on a breadboard (assuming you have a second working Arduino)?

You certainly can with a PIC.

…R

Well, yes, if you can figure out how to do the 12 volt pulse without frying anything. I know I read about a couple such projects, and it apparently isn't too bad. The nice thing about the mighty ohm is it has an on-board dc-dc converter that creates the 12 volts for the pulse. You just plug it into your Arduino and it handles it for you. But seriously, how hard is it to string 8 AA batteries together and run them through a transistor?

It's really even easier than high voltage programming, because all you have to do is kick it into high voltage mode long enough to reset the fuse. The mighty ohm rescue board originally didn't do any programming--just rescuing. I think someone has since written firmware to allow it to program as well.

johnwasser: You will probably need a High Voltage Parallel Programmer to program a chip with a disabled reset.

Never tried it, but I guess you could also force a 'big red switch' reset at the appropriate time during the upload sequence.

PeterH:

johnwasser: You will probably need a High Voltage Parallel Programmer to program a chip with a disabled reset.

Never tried it, but I guess you could also force a 'big red switch' reset at the appropriate time during the upload sequence.

The reset switch is connected to the reset pin, which we're talking about disabling. The ONLY way to make the reset pin back into acting like a reset pin is to use high voltage programming. You can't do the "arduino as ISP" trick -- that's low voltage ISP programming, not high voltage.

I use an STK500 dev board for HV programming, it's a bit fiddly but not something one has to do very often normally.


Rob

WizenedEE: The reset switch is connected to the reset pin, which we're talking about disabling. The ONLY way to make the reset pin back into acting like a reset pin is to use high voltage programming. You can't do the "arduino as ISP" trick -- that's low voltage ISP programming, not high voltage.

I didn't mean to unset the fuse, I meant to enable you to upload a sketch, which implies you need to reset the board. In the absence of a reset pin, you could force the reset by power cycling it, couldn't you?

I don't know for sure but I think you'll find that the internal circuitry looks at the RST pin state to determine what to do, it doesn't just rely on the fact that it is in the process of "resetting".

Also I would bet that when that fuse is set it doesn't bother to look at the pin at all.


Rob

You can wire this one up on a breadboard with six 1K resistors and a transistor. I guess it also rescues chips that have set the prescaler or clock fuses too low.

http://www.rickety.us/2010/03/arduino-avr-high-voltage-serial-programmer/

Graynomad: I don't know for sure but I think you'll find that the internal circuitry looks at the RST pin state to determine what to do, it doesn't just rely on the fact that it is in the process of "resetting".

Also I would bet that when that fuse is set it doesn't bother to look at the pin at all.

I'm just speculating here, but I'd expect the bootloader to run whenever the board boots, and I'd expect it to boot when it is powered up and the reset pin is not active (or is disabled via fuse settings). If the bootloader runs (at the right time in the uploading sequence) then it ought to be possible to upload a sketch to it. That's my theory, anyway. I'm not volunteering an Arduino to test it. :)

PeterH: I'm just speculating here, but I'd expect the bootloader to run whenever the board boots, and I'd expect it to boot when it is powered up and the reset pin is not active (or is disabled via fuse settings).

The bootloader runs on power-up, but in the case of optiboot (Arduino UNO) it only runs at power-up long enough to determine if it is a reset or power-up. If it's a reset then it might be time to upload a new sketch. If it's a power-up it turns control over to whatever sketch is loaded and does not wait for serial input that might indicate an upload.