Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, June 6, 2018 1:05 PM
Currently I have a simple windows form application that talks serially with a scanner running flawlessly on windows 7 embedded . I wish to switch over to windows 10 ioT platform and be able to run the same application on windows 10 ioT enterprise (Build version 14393 ). As I tried running the same application on windows 10 ioT, the pc hangs up as soon as I try to open a serial port using serialport.Open() to start communication. I observed the same on a windows 10 Professional version too!
Further, a tried running a sample UWP app for serial communication from Microsoft , which still did not detect any scanners connected over RS-232 connection. However I am able to establish serial communication using a USB to RS-232 instead on both winform app and sample serial UWP app.
Is RS-232 communication not supported on windows 10 iot ? Is RS232 communication on win 10 using windows form application also not supported?
Here is the code snippet for opening serial ports from winform app -
//Structures
public struct SerialPortConfig
{
public string COMPortNumber { get; set; }
public string BaudRate { get; set; }
public string DataBits { get; set; }
public string Parity { get; set; }
public string StopBits { get; set; }
public string FlowControl { get; set; }
public string StringLength { get; set; }
public int CommInterval { get; set; }
public int TimeOut { get; set; }
public string TermChar { get; set; }
public string[] StartChar { get; set; }
public string Handshaking { get; set; }
public int ReadBufferSize { get; set; }
public int WriteBufferSize { get; set; }
public bool DTREnable { get; set; }
}
public SerialCommDriver(SerialPortConfig serialPortConfig)
{
COMPort = new SerialPort();
COMPort.PortName = "COM" + serialPortConfig.COMPortNumber;
COMPort.BaudRate = Convert.ToInt16(serialPortConfig.BaudRate);
COMPort.DataBits = Convert.ToInt16(serialPortConfig.DataBits);
if (serialPortConfig.Parity == "Odd")
COMPort.Parity = Parity.Odd;
else if (serialPortConfig.Parity == "Even")
COMPort.Parity = Parity.Even;
else if (serialPortConfig.Parity == "None")
COMPort.Parity = Parity.None;
else if (serialPortConfig.Parity == "Mark")
COMPort.Parity = Parity.Mark;
else if (serialPortConfig.Parity == "Space")
COMPort.Parity = Parity.Space;
if (serialPortConfig.StopBits == "1")
COMPort.StopBits = StopBits.One;
else if (serialPortConfig.StopBits == "1.5")
COMPort.StopBits = StopBits.OnePointFive;
else if (serialPortConfig.StopBits == "2")
COMPort.StopBits = StopBits.Two;
else if (serialPortConfig.StopBits == "None")
COMPort.StopBits = StopBits.None;
COMPort.ReadTimeout = serialPortConfig.TimeOut;
COMPort.NewLine = serialPortConfig.TermChar;
}
//End of Structures
private static SerialCommDriver.SerialPortConfig _SerialPortAConfig;
////Get COM port configuration from xml file
XmlNode node3 = document.SelectSingleNode("/LPN/ConfigScannerCOMPort");
_SerialPortAConfig.COMPortNumber =
node3.SelectSingleNode("COMPort").InnerText;
_SerialPortAConfig.BaudRate =
node3.SelectSingleNode("BaudRate").InnerText;
................................
................................
................................
_SerialPortA = new SerialCommDriver(_SerialPortAConfig);
//***********Subscribe to COM port events.
_SerialPortA.COMPort.DataReceived +=
SerialPortA_NewDataReceived;
public static void Start()
{
.........
.........
//Open COM ports.
try
{
_SerialPortA.OpenPort();
Debug_Log("Port from scanner (" +
_SerialPortA.COMPort.PortName + ") is open!",
_RunningAsService);
}
catch (Exception e)
{
Debug_Log("Unable to open required COM port(s). " +
e.ToString() + "", _RunningAsService);
Exit(_RunningAsService);
}
.......
.......
}
public bool OpenPort()
{
if (!COMPort.IsOpen)
COMPort.Open();
return COMPort.IsOpen;
}
All replies (1)
Wednesday, June 13, 2018 3:01 AM
Hi,
Based on your description, I found several users who had the similar issue as yours, they gave the advices may help you, please refer to the link:
RS232 serial port not working
https://www.techadvisor.co.uk/forum/helproom-1/rs232-serial-port-not-working-320190/
Please Note: Since the websites are not hosted by Microsoft, the links may change without notice. Microsoft does not guarantee the accuracy of this information.
Rs-323 serial ports are not working after updating to windows 10 build 1511 (10.0.10586)
Best Regards,
Tao
Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact [email protected].