graczun graczun - 1 month ago 19
C# Question

Read/Write on Serial Port in Windows Universal Platform

I'm currently working on Universal Windows Application(Windows 10) which will communicate with another hardware via virtual COM PORT.

I have tried to use Windows.Devices.SerialCommunication.Serial Port API to communicate. I haven't got any problems on listing available COM ports and opening specified port. Problems occurs on write/read commands on given COM port. I can't receive any answer from mine hardware (received timeouts instead). While using commandline (echo XX > COM4) there wasn't any problems - I received answer on second commandline(type COM4) nearly immediately.

Changing read/write timeout have not solve issue. I'm also sure that Baud Rate and others serial port parameters are ok.
Any ideas why I always get timeouts?

Answer

Found the cause of this problem: I have not add new line signs at end of command. In windows cmd this had to be added automatically.