1

With the new insider preview win 10 iot 10556 the serial port from raspberry pi2 is now available. I want to test it but my SerialDevice is always NULL. Here is my code:

private SerialDevice serialPort = null;

public MainPage()
{
    this.InitializeComponent();
    InitSerial();
}

private async void InitSerial()
{
    string portName = "UART0";

    string aqs = SerialDevice.GetDeviceSelector(portName);

    var myDevices = await DeviceInformation.FindAllAsync(aqs, null);

    if (myDevices.Count == 0)
    {
        Status.Text = "Device not found...";
        return;
    }

    SerialDevice device = await SerialDevice.FromIdAsync(myDevices[0].Id);

    Status.Text = device.PortName;

}

Does somebody try it with success? Where is my failure?

1

And here is the answer for the problem. I have to add these lines to the Package.appxmanifest file.

<Capabilities>
  <DeviceCapability Name="serialcommunication">
    <Device Id="any">
      <Function Type="name:serialPort" />
    </Device>
  </DeviceCapability>
</Capabilities>

Now the serial connection with the on board Rx/TX Pins works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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