cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Started with USB HID , but No Examples in the STM Cube Projects examples folders

Trevor Jones
Senior

haven't run up USB Host before. is there no examples for the H series ?

attached the touch screen,

Using the Cube

C:\Users\DAVE\STM32Cube\Repository\STM32Cube_FW_H7_V1.5.0

I am getting to Application Start, just not sure what to do at that point.

from the foreground : I can read the PID 1, VID 222A. which is the ILITEK USB touch chip

how do I satisfy the initialization sequence ?

How to see the "Touch" bytes coming in ?

sprintf(string, "PID: %xh   VID: %xh \n", hUsbHostFS.device.DevDesc.idProduct, hUsbHostFS.device.DevDesc.idVendor);
	printTW(console , string);

static void USBH_UserProcess2  (USBH_HandleTypeDef *phost, uint8_t id)
{
  /* USER CODE BEGIN CALL_BACK_21 */
 
  switch(id)
  {
  case HOST_USER_SELECT_CONFIGURATION:
  break;
 
  case HOST_USER_DISCONNECTION:
  Appli_state = APPLICATION_DISCONNECT;
  break;
 
  case HOST_USER_CLASS_ACTIVE:
  Appli_state = APPLICATION_READY;
  break;
 
  case HOST_USER_CONNECTION:
  Appli_state = APPLICATION_START;
	  
	    printTW(console, "HID 2 Application has started");  
	  
  break;
 
  default:
  break;
  }

3 REPLIES 3
Trevor Jones
Senior

can someone point me to a working example or document ?

Pavel A.
Evangelist III

Here are the host examples:

... \STM32Cube_FW_H7_V1.5.0\Projects\STM32H743I-EVAL\Applications\USB_Host

>  I can read the PID 1, VID 222A. which is the ILITEK USB touch chip

This is very good. Your host provides power to the device and it enumerates.

Now, tweak the "HID protocol" part. You'll want to change it and make your own.

Study how the "state machine" of HID examples works, and try to read the data.

If you know the size of the data packets of the device, ensure that you read that much.

Else, read its HID report descriptor and find the report size.

-- pa

You're a bit beyond the boundary of the park here...

0690X00000AqStSQAV.jpg

There are class drivers for HID and some examples

STM32Cube_FW_H7_V1.5.0\Projects\STM32H747I-EVAL\Applications\USB_Host\HID_Standalone

STM32Cube_FW_H7_V1.5.0\Projects\STM32H743I-EVAL\Applications\USB_Host\HID_Standalone

perhaps you can instrument the snot out of them, or morph one of the mouse, keyboard, parser classes.

Linux drivers might provide some insight into specific hardware.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..