cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411 USB HID Class ( works on example from HALL, but can't make it work with SPD libraries)

Linas L
Senior II

Hello. I am working on project where i need to control android tablet from MCU (making car headunit with STM32F411E)

I have working ReportDesc that suits my needs, no matter how hard i try i can't make it work on my program

in HID library, All i have to change was discriptor, discriptor report size, and HID_EPIN_SIZE   

But in SPL USB implementations, that's does not help, where are so many more variables that need to be changed or non existing , i have no idea what to do and what to change to what.

In HALL example all i change is this:
 
 
 
#define HID_EPIN_ADDR                 0x81U
#define HID_EPIN_SIZE                    0x05U
#define HID_MOUSE_REPORT_DESC_SIZE    78
 
__ALIGN_BEGIN static uint8_t HID_MOUSE_ReportDesc[HID_MOUSE_REPORT_DESC_SIZE]  __ALIGN_END =
{
  0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
  0x09, 0x06,        // Usage (Keyboard)
  0xA1, 0x01,        // Collection (Application)
  0x85, 0x01,        //   Report ID (1)
  0x05, 0x07,        //   Usage Page (Kbrd/Keypad)
  0x75, 0x01,        //   Report Size (1)
  0x95, 0x08,        //   Report Count (8)
  0x19, 0xE0,        //   Usage Minimum (0xE0)
  0x29, 0xE7,        //   Usage Maximum (0xE7)
  0x15, 0x00,        //   Logical Minimum (0)
  0x25, 0x01,        //   Logical Maximum (1)
  0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
  0x95, 0x03,        //   Report Count (3)
  0x75, 0x08,        //   Report Size (8)
  0x15, 0x00,        //   Logical Minimum (0)
  0x25, 0x64,        //   Logical Maximum (100)
  0x05, 0x07,        //   Usage Page (Kbrd/Keypad)
  0x19, 0x00,        //   Usage Minimum (0x00)
  0x29, 0x65,        //   Usage Maximum (0x65)
  0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
  0xC0,              // End Collection
  0x05, 0x0C,        // Usage Page (Consumer)
  0x09, 0x01,        // Usage (Consumer Control)
  0xA1, 0x01,        // Collection (Application)
  0x85, 0x02,        //   Report ID (2)
  0x05, 0x0C,        //   Usage Page (Consumer)
  0x15, 0x00,        //   Logical Minimum (0)
  0x25, 0x01,        //   Logical Maximum (1)
  0x75, 0x01,        //   Report Size (1)
  0x95, 0x08,        //   Report Count (8)
  0x09, 0xB5,        //   Usage (Scan Next Track)
  0x09, 0xB6,        //   Usage (Scan Previous Track)
  0x09, 0xB7,        //   Usage (Stop)
  0x09, 0xB8,        //   Usage (Eject)
  0x09, 0xCD,        //   Usage (Play/Pause)
  0x09, 0xE2,        //   Usage (Mute)
  0x09, 0xE9,        //   Usage (Volume Increment)
  0x09, 0xEA,        //   Usage (Volume Decrement)
  0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
  0xC0,              // End Collection
};
 
But my old SPL code that is just joystic example, have all these:
 
#define USBD_CFG_MAX_NUM           1
#define USBD_ITF_MAX_NUM           1
 
#define USB_MAX_STR_DESC_SIZ       64 
 
#define HID_IN_EP                    0x81
#define HID_OUT_EP                   0x01
 
#define HID_IN_PACKET                4
#define HID_OUT_PACKET               4
 

Any idea how to make it work ?

I have rest of program made for my project, this is why i don't want to go to HALL, i have to rewrite so much :\

         

0 REPLIES 0