Implementing auto-reset from an RS-232 port

Any good thoughts on this? The crude solution of hooking a cap directly for DTR to the ATMega328's reset pin seems like it would be hard on the chip--instead of going to groun it's going to go several volts below ground.

If I run DTR through the MAX-232, then instead of resetting on the leading edge of DTR, it will reset on the trailing edge of DTR.

Seems stupid to put a 7404 on the board just to get an inverter for reset.

If I go the direct route use a 1N4148 to clamp the reset at -0.6v, is that enough to prevent any damage to the AVR?

If I run DTR through the MAX-232, then instead of resetting on the leading edge of DTR, it will reset on the trailing edge of DTR.

Due to the differential action of the series capacitor you will get a reset pulse on either raising or falling DTR signal, so no need for an inverter, just the change of state will work.

A simple test shows this up on my PC using a serial terminal program that allows direct control of the DTR, I use brey terminal. I load a Real time clock program on my Arduino that sends the time out the serial port. I open the PC brey terminal and watch the time being sent continuously to the PC. When I turn on DTR it causes the Arduino to reset and then after a small delay start again. If I then turn off the DTR signal, once again the Arduino resets and after a delay starts sending again. This is without opening or closing the PC terminal program, proving the just any transition of DTR will reset the Arduino.

If I go the direct route use a 1N4148 to clamp the reset at -0.6v, is that enough to prevent any damage to the AVR?

That should be fine, however the internal negitive clamping diode on the reset pin may be able to handle the short negitive transistion by itself, I never tried it directly with RS-232 high and low voltages through the series cap, just TTL levels.
Lefty

That's weird. With one end of the cap at ground, it will charge through the pull-up resistor until it has 5v of charge. If you then raise that end to 5v, the output from the cap will be at 10v and discharge through the pull-up resistor to the +5v power supply until the cap has no charge stored.

Does the ATMega reset both when pulled to ground and when raised above Vcc?

;D
To your second question. Yes, retrolfty explained that above in detail.

To your first observation: This is how caps work. You need not even read an article about it, it is simple common sense...

Hint: The cap is a battery. What would you see when you tie the minus of a battery to 5V and look at the plus?

Spec sheet for the ATMega doesn't say anything about reseting when rest is pulled to 10v.

It does go into parallel programming mode if you pull it to 12v.

Spec sheet for the ATMega doesn't say anything about reseting when rest is pulled to 10v.

It does go into parallel programming mode if you pull it to 12v.

I think you are over complicating it. A series capacitor blocks steady DC voltages, so the only thing that passes through are short positive and negative pulses with any transition (high to low or low to high) of the DTR signal on the caps input side. Getting the chip into the high voltage programming mode is quite complex and involves a lot more then just raising the reset to +12volts.

From: http://www.electronics-tutorials.ws/rc/rc_3.html

"The Differentiator
The Differentiator is a High Pass Filter type circuit that converts a square wave input signal into high frequency spikes at its output. If the RC time constant is short compared to the time period of the input waveform the capacitor will become fully charged quickly before the next change in the cycle. When the capacitor is fully charged the output voltage across the resistor is zero. The arrival of the falling edge of the input waveform causes the capacitor to reverse charge giving a negative output spike, then as the square wave input changes during each cycle the output spike changes from a positive value to a negative value."

Lefty

Thank you, I'm quite aware of what a series capacitor's behavior is. When DTR is clears, i.e. it goes to + voltages, dv/dt is positive, and you get a positive pulse. When DTR is asserted, it goes to - voltage, dv/dt is negative, and you get a negative pulse.

The original question--about whether the negative pulse can damage the AVR by going below the -0.5 the reset pin is rated for--is unanswered.

From what you said above, it appears that either a positive (above Vcc) or a negative pulse (at or below ground) will reset the Arduino. That's not mentioned in the datasheet, outside the 12v needed to enter parallel programming mode. It's of interest here because a positive pulse can be easily generated by running DTR through the MAX232 chip.

From what you said above, it appears that either a positive (above Vcc) or a negative pulse (at or below ground) will reset the Arduino. That's not mentioned in the datasheet, outside the 12v needed to enter parallel programming mode. It's of interest here because a positive pulse can be easily generated by running DTR through the MAX232 chip.

Well the whole DTR through a series cap to the reset pin is not something you will find in a AVR datasheet I believe, I think it's just something clever that the Arduino people came up with.

The first generation Arduino boards didn't have that circuit but just relied on users do a manual reset at the proper time. And yes from my test above I've proven (at least to myself) that there only requires a change in DTR level (H to L OR L to H) to generate a reset pulse. However I'm pretty sure the Arduino IDE issues a on/off pulse when it activates before uploading.

Of interest, looking at older Arduino schematics they appeared to have used RTS rather then DTR in an earlier version(s). I suspect that the IDE pulses both RTS and DTR to keep compatible with the older boards (to lazy to drag out the scope at this time, it's hot here).

I guess you could hang a 6 volt zener diode from reset to ground if you want too be extra safe.

Lefty

Yeah, using the cap for reset is a standard trick, and perfectly safe with a 0-5v signal. With the RS-232 voltage swing of up to +/-12v it's a bit different. I'll have to go back and look at the serial board schematic again, but I didn't think it had auto-reset. http://www.arduino.cc/playground/Learning/AutoResetRetrofit has an ad-hoc retrofit, but the author wasn't certain how much damage it would do the the AVR.

There's a fine art to getting something simple that doesn't burn itself out over time.

I suspect that the IDE pulses both RTS and DTR to keep compatible with the older boards

This is a function of the USB driver / computer operating system and occurs (or not) when the port is opened or closed. For example the Silicon Labs USB bridge used to do this under Leopard but will no longer do it under Snow Leopard. Where as it still works under XP.