8 Replies Latest reply on Jun 9, 2015 8:23 AM by lth

    Serial port echo gives garbage output

    Richard-d

      I'm having trouble using the Serial1 port (pin 0 for RX and 1 for TX) when trying to echo the PuTTY input. The output on PuTTY is garbage.

       

      For example:

      I type a 1, the echo display an L

      type a 2, get a f

      type a 3, get an &

      type a A, get a P

      type a B get a h

      type a a, get an X

      type a b, get an l

       

      The setup: I connected at NULL modem cable (that uses only Rx, Tx and GND)  to connect pin 0 (rx) and 1 (tx) and 14 (gnd) from my Intel Edison Arduino board to a serial port in my PC. I start PuTTY to input a character that is send via the serial connection to the Edison. PuTTY setup: 9600 8N1 Xon/Xoff.  My loop echoes the input to the output with this tiny program:

       

      int incomingByte = 0;   // for incoming serial data

      void setup()
      {
      Serial1.begin(9600);
      Serial1.println("Serial data sent to Serial1");
      }

      void loop()
      {
      if (Serial1.available() > 0) {
         incomingByte = Serial1.read();  
             Serial1.print((char)incomingByte);
      }
      }

       

       

      It is so small that I hardly can do anything wrong, but clearly I'm overseeing something.

       

      How can I get this echo program working?