title: C# Serial Port Receive Only Ever Giving me a Single Character
body: <p><strong>Question Withdrawn.  I found out that I was sending incorrect ASCII patterns and THIS was my problem versus any problems with the receiver.  Receiving a single character was merely the echo back of my wrong command</strong></p>
  
  <p>Summary:
  C# form app.  Serial 38400:N81 no flow control.  Talking to a custom device.</p>
  
  <p>If I use Teraterm, everything's fine.</p>
  
  <p>The device I attach to gives simple, immediate responses:</p>
  
  <p>Type 'v' you get a version string "v1.34  02-18-16  17:22" where the v in that is the local echo of the typed command.  There are other status commands which are similar, once a character is received by the device, it replies immediately.</p>
  
  <p>In my C# application I have pretty much exactly what you see in this guide under the example:</p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.datareceived%28v=vs.110%29.aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.datareceived%28v=vs.110%29.aspx</a></p>
  
  <p>Differences are that I'm at 38400 versus 9600 and I also do not set up the Handshake or the RtsEnable.</p>
  
  <p>I've done this before so feeling stupid as to some obvious problem here.  And I did do a bit of searching/following similar question links too.</p>
  
  <p>Instead of receiving the version string, I receive one character '6'.</p>
  
  <p>For a different command I also receive one character '8'.  The notable thing here is that while '6' is part of my version string, '8' is never in the response for that other command.</p>
  
  <p>Any suggestions on how I'd debug the ReadExisting() call?</p>
  
  <p>I fully understand that a received string may arrive in fragments.  The issue is that I always only ever receive the one character and nothing else.  The event handler never sees any additional data.  When I re-issue my version command I get the same '6' back I get before.</p>
  
  <p>My event handler where I'm trying to test the receiver:</p>
  
  <pre><code>    private void ReceiveData(object sender, SerialDataReceivedEventArgs e)
      {
          SerialPort sp = (SerialPort)sender;
          string indata = sp.ReadExisting();
          Debug.WriteLine("Data Received: ");
          Debug.Write(indata);
      }
  </code></pre>
  
  <p>Under the debugger, indata.Length is 1.</p>
  
  <p>Teraterm Port Settings:</p>
  
  <p><a href="https://i.stack.imgur.com/XsN12.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XsN12.png" alt="Teraterm port settings"></a></p>
  
  <p>I was suggested to look for errors and here's the code:</p>
  
  <pre><code>    public event SerialErrorReceivedEventHandler ErrorReached;
  
      protected virtual void OnReceiveError(SerialErrorReceivedEventArgs e)
      {
          SerialErrorReceivedEventHandler handler = ErrorReached;
          if (handler != null)
          {
              handler(this, e);
          }
          Debug.WriteLine("Serial error");
      }
  </code></pre>
  
  <p>I saw no errors.</p>
  
  <p>Further comments were that the receiver needs to be run more than once.  It is, when I issue a 'v' (just the v) I should see the version and 's' should give me status.  Again, both work fine on Teraterm.  I get 686868 if I issue vsvsvs or other matching patterns if I type like vvsss, I'll get 66888 in reply.</p>
  
  <p>Other point is controlling this device if I issue r and s for run and stop, there is a LED on it which goes solid red (from intermittent flashing to indicate that it's running.  I see it run and stop per my commands.  So I know that I'm talking to the device in a proper/coherent fashion.  Just still have troubles seeing valid receive data.</p>