Problem Serial Port bytes missing with write method

tomrod 96 Reputation points

Hi everyone, I am using Visual Studio 2013 (C#) in order to test serial port. I have an array of bytes and I am trying to send it via Serial Port using two USBSerialConverter. The data that I receive is between 14 to 18 bytes of lenght (it change everytime i execute the code), not 30 as the size of array.

            byte[] tx_Data = new byte[30];
            string bitString = BitConverter.ToString(tx_Data);
            serialPort1.Write(tx_Data, 0, tx_Data.Length);

The Console.WriteLine from this code is:

but I receive something like.
4F 42 2D 30 35 30 34 2D 32 34 33 36 2C 0C 01 13

What I could be doing wrong?
thanks for your help.

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,379 questions
{count} votes

Accepted answer
  1. tomrod 96 Reputation points

    Finally, the problem was the USB-Serial Converter which I was using (CH340). I changed it to FT232RL and I has able to send all the data. Thanks for your hints.

    Best Regards

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. tomrod 96 Reputation points

    Thanks for your advice,
    by default the baud rate was 9600, then I changed it to 19200 and it works very well. What could be wrong when I use 9600 baud?

  2. tomrod 96 Reputation points

    Now the same code works well sending all the data with 9600 baud, but it works with virtual COM ports. Before I was testing with two ch340 USB-Serial Coverter. Maybe these modules are the problem, I will try with FT232RL.

    Best Regards

    0 comments No comments