title: How to read GPS data from serial port
body: <p>I'm trying to read the data coming in on a serial port from a BU-353S4 USB GPS. I'm getting nothing as far as readable NMEA sentences. The GPS works perfectly with a Raspberry Pi.</p>
  
  <p>This is for a .NET console application. There are similar questions all over the web, but none of the samples seem to work.</p>
  
  <pre class="lang-cs prettyprint-override"><code>var port = new SerialPort
  {
      PortName = "COM5",
      BaudRate = 4800,
      Parity = Parity.None,
      DataBits = 8,
      StopBits = StopBits.One,
  };
  port.DataReceived += Port_DataReceived;
  
  
  private static void Port_DataReceived(object sender, SerialDataReceivedEventArgs e)
  {
      string line = "";
      SerialPort port = (SerialPort)sender;
      line = port.ReadExisting();
      Console.Write(line);
  }
  
  </code></pre>
  
  <p>and...</p>
  
  <pre class="lang-cs prettyprint-override"><code>private static void Port_DataReceived(object sender, SerialDataReceivedEventArgs e)
  {
      SerialPort port = (SerialPort)sender;
      var count = port.BytesToRead;
      var buffer = new byte[count];
      port.Read(buffer, 0, count);
      var line = Encoding.ASCII.GetString(buffer);
      Console.Write(line);
  }
  </code></pre>
  
  <p>No matter what I try, I end up with something like:</p>
  
  <h1>?)))))(((((#Y ?""!!!!!!!? ??z ?----------?D? ?</h1>
  
  <p>?J ?&amp;%%%%%%%%%?? ?%$$$$$$$$$f            Qx ?++++****** ?! ?                  ?              #???? ) xm???? =??       ?
      ?????                               ???? ]? t?   D0??   ????? 3  4???? 2\</p>