Skip to main content
Quoc Khai Trang
Visitor II
June 6, 2018
Question

Custom hid device only send report after 200ms

  • June 6, 2018
  • 0 replies
  • 500 views
Posted on June 06, 2018 at 06:44

Hi all,

I'm trying to create a custom keyboard with STM32F103C8, for the first version, i use HID class. Then i figured out that i can not update leds status. So, i changed to Custom HID class. And i hit this issue. Seem like i only can send one report after 200ms.

This is my code:

Clear_HID_Report();
 keyboardHID.keys[0] = 0x15;
 USBD_CUSTOM_HID_SendReport(&hUsbDeviceFS, &keyboardHID, sizeof(keyboardHID_t));
 HAL_Delay(100);
 Clear_HID_Report();
 keyboardHID.keys[0] = 0x17;
 tmp = USBD_CUSTOM_HID_SendReport(&hUsbDeviceFS, &keyboardHID, sizeof(keyboardHID_t));
 HAL_Delay(100);
 Clear_HID_Report();
 keyboardHID.keys[0] = 0x10;
 USBD_CUSTOM_HID_SendReport(&hUsbDeviceFS, &keyboardHID, sizeof(keyboardHID_t));
 HAL_Delay(200);
 Clear_HID_Report();
 USBD_CUSTOM_HID_SendReport(&hUsbDeviceFS, &keyboardHID, sizeof(keyboardHID_t));
�?�?�?�?�?�?�?�?�?�?�?�?�?�?

This code return: 'rm', 't' are missing.

Then i increase the delay time to 200ms for all HAL_Delay, and i receive 'rtm'. Is there anyone can help me?

I event try this

do {
 tmp = USBD_CUSTOM_HID_SendReport(&hUsbDeviceFS, &keyboardHID, sizeof(keyboardHID_t));
 } while (tmp != USBD_OK);�?�?�?

It's not help, too.

#usb-device #custom-hid-class #timing #keyboard #hid-device
This topic has been closed for replies.