USB HID and composite

The official STMicroelectronics Arduino core
danieleff
Posts: 105
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: USB HID and composite

Postby danieleff » Sun Nov 27, 2016 6:37 am

On Win10, Arduino 1.6.10, Java 1.8.0_92-b14.
It seems I do not have to use libwdi, as Win10 takes care of the serial driver automatically, in the event manager:

Code: Select all

Driver Management concluded the process to install driver usbser.inf_amd64_5de2576d6f02918e\usbser.inf for Device Instance ID USB\VID_0483&PID_5750&MI_00\6&2B048C5C&0&0000 with the following status: 0x0.
Driver Management has concluded the process to add Service usbser for Device Instance ID USB\VID_0483&PID_5750&MI_00\6&2B048C5C&0&0000 with the following status: 0.


The Win7 machine does not have Arduino as it is an old laptop, so I just checked if the device manager lists the COM port (After running wdi installer). If it still does not work for you, I may install the IDE on that.

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB HID and composite

Postby RogerClark » Sun Nov 27, 2016 6:39 am

Update.

Installing the latest IDE fixed it. I think I may have had a custom version of listports.dll installed, but I can't remember why I did that .

Anyway....

When I push the button I just get a message via Serial USB, but I don't seem to get a real button push on the mouse.

And if I push the button a few times it seems to crash after the 4th push

As all I get is

Code: Select all

Button pressed
Button pressed
Button pressed
Button pressed


If I push a few more times nothing happens

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB HID and composite

Postby RogerClark » Sun Nov 27, 2016 6:49 am

Daniel

I tried

Code: Select all

int c=0;
int previous_buttons = 0;
unsigned long m=0;
void loop() {


 if (millis() - m>1000)
 {
  Serial.println(c++*2);
  m=millis();
 }
  if (previous_buttons != digitalRead(BUTTON_PIN))
  {
    hidreport[0] = digitalRead(BUTTON_PIN) ? 1 : 0;
    previous_buttons = hidreport[0];
    USBD_HID_SendReport(&hUsbDeviceFS, hidreport, 4);
    digitalWrite(LED_BUILTIN, hidreport[0]);

    Serial.println("Button pressed");
  }
 
}



And serial keeps outputting until I press the button 3 times.

After that it stops.

But its not completely broken, becuase the IDE can reset the board to upload, so the USB Serial is still receiving data, just not sending it

The code has not totally crashed either as the LED still lights when I press the button

danieleff
Posts: 105
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: USB HID and composite

Postby danieleff » Sun Nov 27, 2016 7:15 am

It seems it thinks the whole device is serial, and tries to parse the button HID reports too.
I would still try to install with --iid 0 so only the serial interface part gets the serial driver (and uninstall the previous from 0x5750, or use differen PID usbd_desc.c).

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB HID and composite

Postby RogerClark » Sun Nov 27, 2016 7:24 am

I tried using --iid 0 but I have not totally changed the PID (again)
I'll move it to --pid 0x5751 and let you know what happens

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB HID and composite

Postby RogerClark » Sun Nov 27, 2016 7:37 am

Tried 0x5751 and also 0x5760

HID is now working but Serial driver won't load

serial_driver_not_recognised.png
serial_driver_not_recognised.png (54.9 KiB) Viewed 118 times


I tried running

"%~dp0wdi-simple" --vid 0x0483 --pid 0x5760 --iid 0 --type 3 --name "Maple Serial" --dest "%~dp0maple-serial"

But it didnt install the driver

If I remove the --iid 0 the Serial driver appears but HID is removed :-(

danieleff
Posts: 105
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: USB HID and composite

Postby danieleff » Sun Nov 27, 2016 7:43 am

Thank you for your trouble. I will investigate further from my Win7 laptop next week. Seems like the only missing thing is to install the serial driver to only that part of the device (which should be --iid 0), not the whole. (I mean it works on my Win10 both simultaneously )
*EDIT sorry for the additional installed drivers. Do you know how to remove them from a PID (when the device is not plugged in)? :)

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB HID and composite

Postby RogerClark » Sun Nov 27, 2016 8:58 am

No worries

I'll recompile for 0x5760, and 51 and 50 and see if I can remove them manually after loading each version into the Maple mini

BTW.

I tried using this http://www.nirsoft.net/utils/usb_devices_view.html it didnt seem to remove the drivers, even though it claimed it could

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB HID and composite

Postby RogerClark » Sun Nov 27, 2016 9:03 am

Daniel

BTW. It would be better if you updated your makefile from the one in the WIP branch as you makefile has a problem with the VL Discovery build unless I do "make clean" first.
I'm sure this has been fixed

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB HID and composite

Postby RogerClark » Sun Nov 27, 2016 9:37 am

Daniel

I tied connecting to a different machine, albeit one that had a Maple Mini connected before (but not the new STM repo and STM Virtual serial port etc.

And I got this USB installation popup (Sorry for the low quality, I had screengrab on one machine and email it to another and it didnt come out of the email in high quality.

too_many_devices.png
too_many_devices.png (25.02 KiB) Viewed 98 times


This looks strange.

I'm not sure why it has the Maple 003, and 2 x STM32 Virtual ComPort, as well as the USB Composite device

Are you sure you built the USB descriptor tables correctly ?


Return to “STM Core”

Who is online

Users browsing this forum: No registered users and 1 guest