I want to do serial communication from an emulator running on the PC to a
real device connected via a serial port. I have taken the code from Jens
Kühner and finally got some response from the port.
I have extended the Emulator with the following code:
public override void SetupComponent()
ComPortToPhysicalPcSerialPort comPort = new
comPort.ComPortHandle = new ComPortHandle(TransportType.Usart, 2);
comPort.Baudrate = 115200;
comPort.PhysicalPortName = "COM1";
comPort.Handshake = System.IO.Ports.Handshake.RequestToSend;
Here ComPortToPhysicalSerialPort is Jens Kühner's Code.
"COM1" is the physical port of the PC.
And I need "new ComPortHandle(TransportType.Usart, 2);"
because my app uses the "COM2" port.
The code of the app is:
serialPort = new SerialPort("COM2", 115200, Parity.None);
serialPort.Handshake = Handshake.RequestToSend;
catch (Exception ex)
When doing this I get the following output:
Exception was thrown: System.ArgumentException
But I don't find anything about HandlePinReservations.
And it doesn't seem to be a problem of the app as it already is running on
Has anyone experienced this too?
And what can I do to get more specific information about this behaviour?
And finally solve the problem?