Why would anyone want to use RESET pin as PIO?

I am using Atmega328. PC6 is also used as a reset pin. I am wondering why would anyone want to use this pin for PIO because the MCU will lose the reset function. Without reset, how can one do firmware programming?

Maybe you don't need an external reset but do need one more IO pin.

Without reset, how can one do firmware programming?

You have to ensure that when reset is driven by the programmer that your hardware is not also trying to drive that pin.


Rob

Graynomad: You have to ensure that when reset is driven by the programmer that your hardware is not also trying to drive that pin.

If you're using the pin for I/O you usually have to disable the reset function so you lose the ability to program the chip...

...unless you use a high voltage programmer.

Yes you're right Fungus, you need an HV programmer.

Been a while since I worked with those small chips.


Rob

I'm not sure you'd use the reset pin very often on a Mega328 but an extra pin is worth a lot on (eg.) a Tiny85.

On some chips, it may be the only way to access an entire hardware port. If you're building a commercial project and need to do 8-bit parallel I/O, it might be worth scrapping the reset pin, which might otherwise be hard-wired to Vcc anyway. Aside from maybe a single development board, you'll only need it for initial programming and any service work. As fungus mentioned, if and when it came time to update the code, you would use a high voltage programmer to override it.

Things are different at the hobbyist level, and you're right, you should probably just use a chip with sufficient I/O to avoid having to repurpose the reset pin. :-)

actually you dont lose ability to program at all. ardunino bootloader works just as well by cycling power as by grounding reset. in fact by buffering the dtr output of the dongle there is little difference compared to using the reset pin. when using a real serial port instead of usb you dont even need to buffer.

I think the OP's referring to writing directly to flash, not uploading sketches. Direct programming is required to put the bootloader on bare AVR chips, or to reprogram chips that don't use a bootloader.

op gave no hint of that. and im guessing most here in the arduino forum do have chips with a bootloader. in any case my comments were mainly in response to replies that avr cannot be programmed w/o reset which turn out not to be quite true.

Most folks in Arduino-land aren't setting fuses to disable reset either. ;) It's an uncommon request with a very specific caveat.

Anyway, you were right -- you can be tricky and time a serial upload just after power-up. But for flash programming the AVR will only enter programming mode while reset is held low. I don't know how long I was flashing AVRs before I knew that, so it's worth pointing out that there is no alternative (until you brute force your way in via HV programming.)

SirNickity: Most folks in Arduino-land aren't setting fuses to disable reset either.

what forum are you browsing? a quick search for "bricked" or "cant flash anymore" tells the true story. many tales of woe. im an avr expert but still have a big box of chips needing hv fix. avrdude is a chip killer.

and you dont need tricky timing to flash w/o reset. simply buffer the dtr pin and power from that.

john1993:

SirNickity: Most folks in Arduino-land aren't setting fuses to disable reset either.

what forum are you browsing? a quick search for "bricked" or "cant flash anymore" tells the true story. many tales of woe. im an avr expert but still have a big box of chips needing hv fix. avrdude is a chip killer.

and you dont need tricky timing to flash w/o reset. simply buffer the dtr pin and power from that.

What do you mean by 'buffer the dtr pin and power from that', I can't envision what that actually means.

Lefty

it means change the normally microamp drive capability of dtr to hundreds of milliamps or whatever is needed to power the target. a simple transistor can do this cheaply. ive been using this method for some time now to program avr, specifically tiny, that have rstdsbl active. many of my projects just needed that one last pin.

So to clarify, you are using a bootloader to program the avr. And to run the bootloader from power-up you use the DTR signal to trigger the power to the avr? The trade off for the extra I/O pin is sacrificing some space for the bootloader?

john1993:
it means change the normally microamp drive capability of dtr to hundreds of milliamps or whatever is needed to power the target. a simple transistor can do this cheaply. ive been using this method for some time now to program avr, specifically tiny, that have rstdsbl active. many of my projects just needed that one last pin.

And how does the chip get powered when the IDE turns off the DTR signal after performing the upload?

Lefty

Most folks in Arduino-land aren't setting fuses to disable reset either.

a quick search for "bricked" or "cant flash anymore" tells the true story. many tales of woe.

Most of the "bricked chip" tales I've seen have been due to people mis-programming the clock source, rather than disabling the RESET pin. The former is relatively easy to do just by mis-interpreting phrases like "external clock" vs "external crystal", while the RSTDISBL fuse is more obviously something to avoid changing.

retrolefty: And how does the chip get powered when the IDE turns off the DTR signal after performing the upload?

the way that arduino signal works is to keep high all the time except for brief period when it resets the chip. so no problem actually powering the chip and often accessory circuits too.

oh... i should mention that imo it is silly to load not only all that usb baloney on every board but even the resistor/cap circuit is dead weight. these belong on the programming dongle and avr chips belong on the target board. i see in the latest m1284 thread many others are coming around to this line of reasoning too. or at least half way there.

regarding bricked chips i dont really consider bad clk fuse actually bricked. rstdsbl though... bricked mortared and set. everybody has a signal source somewhere but few have 12v programmers.