Pages: [1]   Go Down
Author Topic: How to send a reset request from C# like Arduino 1.0 IDE?  (Read 834 times)
0 Members and 1 Guest are viewing this topic.
USA, Arizona
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I created a Serial read/write in C#.  I would like to add the Arduino reset feature to my C# application like the Arduino 1.0 IDE serial application does on start-up and exit.  Does anyone have an example that I could work from?
Logged

USA, Arizona
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got it working in about 5 minutes by hooking up a wire from PWM Port12 to the RESET Port.  On the Arduino I checked for the text RESET on the incoming SerialEvent3.  When RESET is found do: pinMode(7, OUTPUT);  digitalWrite(7, LOW);  As for as the C# it was as simple as:
if (serialPort1.IsOpen) { serialPort1.Write("RESET"); }.  Reset seems to work as expected.
Logged

USA, Arizona
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An even better approach is configure  serial1.DtrEnable = true; in c#.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got it working in about 5 minutes by hooking up a wire from PWM Port12 to the RESET Port.  On the Arduino I checked for the text RESET on the incoming SerialEvent3.  When RESET is found do: pinMode(7, OUTPUT);  digitalWrite(7, LOW);  As for as the C# it was as simple as:
if (serialPort1.IsOpen) { serialPort1.Write("RESET"); }.  Reset seems to work as expected.

The AVR datasheet and related application notes are pretty clear that driving the reset pin from a digital output pin is not recommended practice and can result in incomplete hardware reset function. Upon reset first all I/O pins are  defaulted to input mode thus removing the active low reset signal. This results in a reset pulse width too narrow to accomplish a full proper reset. So use at your own risk but it's something the chip manufacture explicitly states you should not do.

Logged

Pages: [1]   Go Up
Jump to: