2025-05-06 6:08 PM - last edited on 2025-05-07 2:31 AM by Andrew Neil
Hello everyone,
I am using a NUCLEO-F446ZE board as a USB device.
I use EP1(IN/OUT) for bulk transfer and EP2 IN for Interrupt transfer.
USB firmware side(STM32F446ZE), I send EP2 data as below.
i call USBD_LL_Transmit(pdev, ep_addr, pbuf, size) then calls
HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum).
everything up to this step seems fine and EP2 IN data is stored in FIFO.
However when PC(host side) polls for EP2 IN data, PC can`t receive the data.
I use WinUSB to poll EP2 IN data.
WinUsb_ReadPipe(winusbHandle, ENDPOINT_INT, interruptBuffer, sizeof(interruptBuffer), &bytesRead, NULL);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
000058: Bulk or Interrupt Transfer (UP), 2025-05-07 09:50:43.1859061 +0.2135957. (1. Device: )
Status: 0xc0010000
Pipe Handle: 0x22737730 (Endpoint Address: 0x82)
Get 0x0 bytes from the device
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
and HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) has not been called at all.
I dont know why when PC polls for EP2 IN data it`s not getting anything.
USB device seems not responding to PC polling, is it possible that my interrupt for detecting PC polling is not properly set?
when PC polls for EP IN data what kinds of data format or request does it send and how shall I detect this poll request from my usb device firmware?
thank you very much!
Solved! Go to Solution.
2025-05-07 5:36 AM
Hi @usbdes777
Would you attach minimum project to reproduce on my end?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-05-07 5:36 AM
Hi @usbdes777
Would you attach minimum project to reproduce on my end?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-05-12 5:35 PM
Sorry for replying late, I have been away for a few days.
I have attached my source code and it would be very helpful if you could take a look.
I used STM32CubeIDE USB device library and selected USB CDC class.
For EP1(in/out) bulk transfer I used these two functions in usbd_cdc_if.c.
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
and it worked fined. Then I try to add an EP2 IN interrupt transfer
to report usb device status to PC every 100ms without using cdc class.
I made this function to send EP2 IN data to PC
uint8_t USBD_EP2_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
in usbd_core.c.
and in stm32f4xx_hal_pcd.c I modified this function
if (__HAL_PCD_GET_FLAG(hpcd, USB_OTG_GINTSTS_IEPINT))
so that when PC polls for EP2 IN, usb device can recognize the poll and run
uint8_t USBD_EP2_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
to start the wholle sending process.
Am I on the right track?
Thank you very much.