0

I have some c# code, checking all available ports for a special connected external hardware.
The code works fine, finding the hardware for all standard baudrates AND all ports.
I my case I have to use ComPort.BaudRate = 250000 , which is no standard.
Starting with COM1, SerialPort.Open() then throws an IOException : "The parameter is incorrect.".(below 250000 works fine).
In contrast to this all other available ports, COM16, COM17 and COM3 where the hardware is connected, work fine with this high baudrate.
Any idea how avoid this exception or at least ignore it for COM1 (maybe on different hardware it might be a different port which fails)?

Edit:
OK, I tried it on different machines, connecting to all available USB-Ports (2.0/3.1) and also across USB-hubs. It works all the same: only COM1 throws an exception and the other ports work fine.
Btw. there is an FTDI-chip on the external hardware for UART communication.
Still don't know how to ignore the "System.IO.IOException: The parameter is incorrect" when trying to open a port, or would it be a viable way to ignore all exceptions on opening a port (maybe bad idea)?

BEsmart
  • 25
  • 3
  • Check the driver that is being used. You can use the driver name as part of the connection. – jdweng Dec 22 '22 at 18:04
  • This SO post might be helpful in your case: https://stackoverflow.com/questions/1165692/how-to-programmatically-find-all-available-baudrates-in-c-sharp-serialport-clas – CoolBots Dec 22 '22 at 18:57
  • What hardware do you have to provide the COM ports? Typically COM1 would be a built-in port (on the mainboard), while all others are provided via USB-to-Serial adapters. So it's very likely that they have different capabilities. – PMF Dec 22 '22 at 20:35

0 Answers0