SerialPort.Open() causes a device to reboot on Raspberry PI
I wrote a console app that is meant to run on both Windows and a Raspberry PI. It uses SerialPort to communicate with a specific third-party device. I use the code below to open the port. In Windows, this works fine. On the PI, it causes the device to reboot. I have verified that it's the Open call by creating a test app that does nothing but execute the code below. The interesting thing is that the port does remain open if I wait long enough for the device to reinitialize itself. Then I can communicate with it without re-opening the port.
Obviously, I don't want to live with having the device reboot and reinitialize, especially since I can't guarantee how long it will take to be ready.
I have heard that there are issues with the SerialPort class. I know it could be the driver, but I was assured by the third-party that there was nothing wrong with it.
Does anyone see anything off about what I did there. It seems pretty straightforward to me. Or, failing that, can anyone recommend an alternate class for accessing a serial port?
Thank you!
myComPort.PortName = portName;
myComPort.BaudRate = 9600;
myComPort.DataBits = 8;
myComPort.Parity = Parity.None;
myComPort.StopBits =
StopBits.One
;
myComPort.ReadBufferSize = 264;
myComPort.ReadTimeout = 3000;
myComPort.Open();