2017-01-26 05:16 AM
Hi,
I am struggling to make a vendor device, that sends request on control pipe endpoint 0 out (EP0_OUT), I can receive the request correctly, but I can't send an ACK back (zero length packet). I have tried USBD_CtlSendData(), USBD_CtlSendStatus(),...the response doesn't seem to be sent anyway, neither on EP0_IN.
I have other requests coming on EP0_IN and everything works correct. I have been looking the library and had noticed, that any transmit request is parsed to be sent on EP0_INHAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len)
{ PCD_EPTypeDef *ep = NULL; ep = &hpcd->IN_ep[ep_addr & 0x7F]; /*setup and start the Xfer */ ep->xfer_buff = pBuf; ep->xfer_len = len; ep->xfer_count = 0; ep->is_in = 1; ep->num = ep_addr & 0x7F;HAL_PCD_EP_Transmit() calls USB_EPStartXfer, but before it sets ep->is_in=1, indicating to EP0_IN always.
USB_EPStartXfer then checks if it has to send to IN or OUT endpoint.HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx , USB_EPTypeDef *ep)
{ uint16_t pmabuffer = 0; uint32_t len = ep->xfer_len; /* IN endpoint */ if (ep->is_in == 1) { /*Multi packet transfer*/ if (ep->xfer_len > ep->maxpacket)So, how could I send to EP0_OUT?
#stm32driver-usb2018-09-10 09:45 AM
I had the same issue,I guess.
After I detect my vendor request,
I have to call this to receive the data.
USBD_CtlPrepareRx (pdev, myBuffer, sizeOfData)
That's do the trick for me.