none
Cannot connect to serial port at 115200 baud RRS feed

  • Question

  • I have a funny problem...I have some software that is working with lots of computers (over 100) It connects to a serial port using the .NET serial port class. The software must connect at 115200 for all the features to work. Now normally there is no issue. However, I have two computers that cannot connect at 115200. They can connect at 19200 or 9600 but not 115200. In addition, they can connect at 115200 with a few other pieces of software without issues! This is what is happening when looked at with a serial port sniffer:

     19200 Baud Trace:

    [29/04/2018 19:05:26] - Open port COM3

    [29/04/2018 19:05:26]Changed baudrate: 19200

    [29/04/2018 19:05:26]Disabled RTS

    [29/04/2018 19:05:26]Disabled DTR

    [29/04/2018 19:05:26]Changed line control: Databits 8, Parity none, StopBits 1

    [29/04/2018 19:05:26]Changed flow control: ControlHandShake 0x00, FlowReplace 0x00, XonLimit 55546, XoffLimit 55546

    [29/04/2018 19:05:26]Changed baudrate: 19200

    and this is at 115200

     115200 Baud trace:

    [29/04/2018 19:10:43] - Open port COM3

    [29/04/2018 19:10:43] - Close port COM3

    [29/04/2018 19:10:43] - Open port COM3

    [29/04/2018 19:10:43] - Close port COM3

    Does anyone have any ideas what is happening?

    Here is the code:

                port = new SerialPort(comport, baud);
    
                port.ReadTimeout = 20;
                port.Open();
    Monday, April 30, 2018 3:21 AM

All replies

  • Hi tomb1818,

    I would suggest that you could subscribe to the DataReceived Event to check if it is firing at all. please set DTR and RTS to true, if the connected device needs them it will not transmit data. here is a sample for your reference.

    static void Main(string[] args)
            {
                const int bufSize = 2048;
                Byte[] buf = new Byte[bufSize]; //To store the received data.
                string comport = "COM1";
                int baud = 115200;
                SerialPort port ;
                
                port = new SerialPort(comport, baud);
                port.DataReceived += port_OnReceiveDatazz; // Add DataReceived Event Handler
                port.DtrEnable = true;
                port.RtsEnable = true;
                port.ReadTimeout = 20;
                port.Open();
            }
    
            // My Event Handler Method
            private static void port_OnReceiveDatazz(object sender,
                                       SerialDataReceivedEventArgs e)
            {
                SerialPort spL = (SerialPort)sender;
                const int bufSize = 12;
                Byte[] buf = new Byte[bufSize];
                Console.WriteLine("DATA RECEIVED!");
                Console.WriteLine(spL.Read(buf, 0, bufSize));
            }

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 1, 2018 3:20 AM
    Moderator
  • I have further information.  You may want to inform someone in driver development about this...

    When the port is opened, the operating system immediately reports that the maximum baud rate is 23800 and then closes the port.  You cannot do anything else.

    I found out what the issue it: The serial port drivers in this case are the Silicon Labs drivers for the CP210x USB to UART bridge. It appears that there are two sets of drivers for this device.  One is the standard Windows driver with version numbers of 6.xxx and the other are the Windows Universal Drivers with version 10.xxx

    The Universal Drivers, report that the maximum baud rate is 23800 which is not true.  It appears it doesn't to this with some other libraries but does with .NET 4.0 serial port class.

    According to some of my users, Windows update has replaced the 6.xx drivers with the 10.xx drivers.

    Tuesday, May 1, 2018 2:47 PM
  • Hi tomb1818,

    According to your description, it seems that you have found what cause the issue, please mark it as answer, it will be beneficial other communities who have the similar issue.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 2, 2018 5:11 AM
    Moderator