I have a GrovePi board, attached to my Raspberry PI 2. I want to read the GPS sensor, using the RPISER port on the GrovePi in my Universal Windows App (Windows 10 IoT Core), but it fails with the following exception:

System.ArgumentException: The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name: portName at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace) at System.IO.Ports.SerialPort.Open() at Nebulus.IoT.Gateway.GrovePiBridge.StartupTask.d__1.MoveNext()

I tried with all COMx (1-10) combinations, but have the same exception every single time.

This is the code I use. Any idea on the issue? (I have enabled serial port communication in the app manifest)

SerialPort sp = new SerialPort("/dev/ttyAMA0", 115200, Parity.None, 8, StopBits.One);

2 Answers 2


Due to IoT running on many other boards other than a Rasbperry Pi, the names of the Serial Devices are currently named as in the drivers for that particulr chipset.

Unfortunately.. this means extremely convoluted names. The best way to do it (and also makes it cross device compatible) is to iterate over available serial 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);

That is a snippet that will spit out the serial port names while connected with a debugger in Visual Studio.

What I recommend, is to create a List<collection> in the loop, then you can look at the ID to see if it says UART, FTDI, USBxyz - etc etc

 ConfigAppPort = await SerialDevice.FromIdAsync(dis[0].Id);
  • thanks for your answer. I only get one serial port printed, which is the MINWINPC port (\\?\ACPI#BCM2837#4#{86e0d1e0-8089-11d0-9ce4-08003e301f73}\0000000000000007). I don't believe that is the right one (on my grove-pi board), or would it? As you can understand from my questions, I'm very new to the whole concept of these ports/boards. Dec 15, 2017 at 8:39
  • Yes.. that is going to be the "port" name.. unfortunately. Windows IoT UWP applications run in a sandbox so the port is actually the drivers actual ACPI location.. As I mentioned.. there are no friendly names mapped yet.. which is a big bummer.
    – Piotr Kula
    Dec 15, 2017 at 14:17

Based on the answer of @ppumkin , I created a sample that you can find on github: https://github.com/SamVanhoutte/grove-gps-net . It combines the SerialDevice reading with the NMEAParser Nuget package to parse the actual GPS data packages.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.