STM32 delay not working as expected with USB HID
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-13 2:12 PM
I am trying to send a shift + U keypress to the screen every two seconds but it is just printing U's nonstop. Why isn't it delaying for two seconds? How do I properly debug stuff like this in the future?
while (1)
{
hid_report_buffer[0] = 0x02; //0b00000010;
hid_report_buffer[2] = 0x18;
USBD_HID_SendReport(&hUsbDeviceFS, hid_report_buffer, 8);
hid_report_buffer[0] = 0x00; //0b00000000;
hid_report_buffer[2] = 0x00;
USBD_HID_SendReport(&hUsbDeviceFS, hid_report_buffer, 8);
HAL_Delay(2000);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
Labels:
- Labels:
-
USB
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-13 2:18 PM
Because the "release" code probably does not get on the wire. Can you see why?
-- pa
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-13 4:13 PM
I think it is because of the polling interval on the host. It works when I insert a delay larger than the polling interval. But I am still confused as why the delay is not being hit at all in the first case.
