SerialPort Issue Connecting FEZ to PC

I’m having data issues when I try to connect my FEZ Cobra to a PC via a serial port. Data that is sent in both directions gets corrupted. On the Cobra side, I get frame errors (code 4) when receiving data.

Here are some additional information:

  1. I’m using the latest GHI Premium firmware (4.2.10)
  2. I tried COM3 and COM4 with just RX and TD connected (plus ground).
  3. The setup is standard 9600, 8 data bits, no parity, 1 stop bit, no handshaking.
  4. It works fine connected to a FEZ Mini board.
  5. It works fine with a hardware loop back (RX connected to TD).
  6. The PC works fine with a hardware loop back.
  7. The PC app uses .Net.
  8. TeraTerm also receives corrupted data.
  9. I tried two USB/Serial adapters and a direct connect to the serial port of the PC with the same behavior.

Any suggestions would be most appreciated.

Thanks - Mark.

Here is the code I’m using to test this, it’s the same for the Cobra, Mini, and PC.

        static SerialPort UART;
        public static void TestUART()
        {
            UART = new SerialPort("COM3"); // COM23 for PC/USB, COM1 for PC/Serial Port
            UART.BaudRate = 9600;
            UART.Parity = Parity.None;
            UART.StopBits = StopBits.One;
            UART.DataBits = 8;
            UART.Handshake = Handshake.None;
            UART.Open();
            UART.DataReceived += new SerialDataReceivedEventHandler(UART_DataReceived);
            UART.ErrorReceived += new SerialErrorReceivedEventHandler(UART_ErrorReceived);

            while (!UART.IsOpen)
                Thread.Sleep(100);

            Byte[] buffer = { 77 };
            while (true)
            {
                UART.Write(buffer, 0, 1);
                Thread.Sleep(1000);
            }
        }

        private static void UART_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            Console.WriteLine("Data Received");
            byte[] data = new byte[1];

            UART.Read(data, 0, 1);
            Console.WriteLine("Data Byte=" + data[0]);
        }
        private static void UART_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
        {
            Console.WriteLine("Error - " + e.EventType);
        }

If you connected the serial port on the Cobra directly to the PC’s serial port is is possible that you have blown the serial port on the Cobra.

I connected my Cobra to my Mini and it’s still working so I’m guessing I’m good.

Thanks, I’ll order the module and give it a go.