List All UART Ports


	string AqsFilter = SerialDevice.GetDeviceSelector();
	var dis = await DeviceInformation.FindAllAsync(AqsFilter);
	for (Count = 0; Count < dis.Count; Count++)
		System.Diagnostics.Debug.WriteLine("UART Port: " + dis[Count].Name + ", " + dis[Count].Id);

Connect To A specific UART Port


	string AqsFilter = SerialDevice.GetDeviceSelector();
	var dis = await DeviceInformation.FindAllAsync(AqsFilter);
	for (Count = 0; Count < dis.Count; Count++)
	{
		if (dis[Count].Id.Contains("FTDI"))			//We are looking for a FDTI USB to serial USB device
			break;
	}
	if (Count < dis.Count)
	{
		//----- SERIAL PORT FOUND -----
		ConfigAppPort = await SerialDevice.FromIdAsync(dis[0].Id);

		//Configure serial settings
		ConfigAppPort.WriteTimeout = TimeSpan.FromMilliseconds(1000);    //mS before a time-out occurs when a write operation does not finish (default=InfiniteTimeout).
		ConfigAppPort.ReadTimeout = TimeSpan.FromMilliseconds(1000);     //mS before a time-out occurs when a read operation does not finish (default=InfiniteTimeout).
		ConfigAppPort.BaudRate = 9600;
		ConfigAppPort.Parity = SerialParity.None;
		ConfigAppPort.StopBits = SerialStopBitCount.One;
		ConfigAppPort.DataBits = 8;

 

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.