This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Connect to HidDevice with UsbDevice class in UWP app

Hi,

I'm using the stm32f746g-discovery board with the Keil USB HID example. I can connect to the USB HID device with a UWP app using the HidDevice class.
Is it also possible to use the UsbDevice class to connect to the board when using the Keil USB HID example? I want to try to use interruptOut to connect to the board and this is only possible with the UsbDevice class.

The UWP app I made with the UsbDevice class does not seem to connect to the USB of the discovery board (no problem with the HidDevice class UWP app).

Am I trying something that is impossible or am I doing something wrong with the connection?

I'm using the example code from Microsoft to connect:

private async void OpenDevice()
    {
        UInt32 vid = 0x045E;
        UInt32 pid = 0x0611;

        string aqs = UsbDevice.GetDeviceSelector(vid, pid);

        var myDevices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(aqs);

        try
        {
            usbDevice = await UsbDevice.FromIdAsync(myDevices[0].Id);
        }
        catch (Exception exception)
        {
            ShowStatus(exception.Message.ToString());
        }
        finally
        {
            ShowStatus("Opened device for communication.");
        }

    }

With the correct vid & pid (works with HidDevice class).

I'm new to USB implementation and trying to learn.

thx

Parents
  • There is an example application named HIDClient for MS Windows which can be used to test USB HID device.
    If you have Keil MDK then the source code (and executable) is located in the Keil MDK installation in the \ARM\Utilities\HID_Client folder.

Reply
  • There is an example application named HIDClient for MS Windows which can be used to test USB HID device.
    If you have Keil MDK then the source code (and executable) is located in the Keil MDK installation in the \ARM\Utilities\HID_Client folder.

Children