2018-05-14 04:08 PM
STM32L4xx
HAL 1.11 Framework
Modifying the ST USB Host library to include the missing states in the
static USBH_StatusTypeDef USBH_HID_Process(USBH_HandleTypeDef *phost)�?�?
method that runs the HID Class.
SEND_DATA - for sending packets TO the HID device
BUSY - used as a polling state after data sent.
Wondering if the USB experts on here can look at the state transitions and validate the state and transition correctness.
The last question is Data0/Data1 toggling. It appears that is happening somewhere in a lower level. Do I need to manually toggle the Data0/Data1 in the state?
#usb-hid #usb_hostSolved! Go to Solution.
2018-05-17 10:01 AM
Or for larger than single frames:
2018-05-14 11:19 PM
I believe I've found the answer to the last question, 'does the data0/data1 need to be manually toggled'.
In the interrupt handler located in `stm32l4xx_hal_hcd.c` file:
static void HCD_HC_IN_IRQHandler (HCD_HandleTypeDef *hhcd, uint8_t chnum)
{
...
else if(hhcd->hc[chnum].ep_type == EP_TYPE_INTR)
{
USBx_HC(chnum)->HCCHAR |= USB_OTG_HCCHAR_ODDFRM;
hhcd->hc[chnum].urb_state = URB_DONE;
HAL_HCD_HC_NotifyURBChange_Callback(hhcd, chnum, hhcd->hc[chnum].urb_state);
}
hhcd->hc[chnum].toggle_in ^= 1;
...�?�?�?�?�?�?�?�?�?�?�?�?
The last line is the toggle.
2018-05-17 10:01 AM
Or for larger than single frames:
2018-05-28 12:52 PM
static void HCD_HC_OUT_IRQHandler (HCD_HandleTypeDef *hhcd, uint8_t chnum)�?
Tested. The above state transitions work with the existing ST HOST USB Library. However, I did find that the OutPipe does not toggle the Data0/1 line like the InPIpe does. Bug? Adding a data toggle after a successful frame transfer solved the issue.
case HID_BUSY:
if(USBH_LL_GetURBState(phost, HID_Handle->OutPipe) == USBH_URB_DONE)
{
USBH_LL_SetToggle(phost, HID_Handle->OutPipe, 1 ^ USBH_LL_GetToggle(phost, HID_Handle->OutPipe));
�?�?�?�?�?�?�?�?�?
Confirmed: Out Interrupt handler doesn't implement an Interrupt transfer data toggle.
static void HCD_HC_OUT_IRQHandler (HCD_HandleTypeDef *hhcd, uint8_t chnum)�?