cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_PCD PCD_GET_EP_RX_CNT only return 0

frangipane
Visitor

Hello,

 

I am working on a stm32u083rc. I'm trying to establish a USB Serial connection using the HAL_PCD library. I'm at the enumeration stage and trying to read the data sent by the PC (windows).

The USB device is initialized with CubeMX (STM32Cube FW_U0 V1.2.0) in Device only, Full Speed, interrupts enabled.

In my setup, I call the HAL_PCD_Start() function. Windows will detect a connection and attempt to enumerate it. At this point, the HAL_PCD_ResetCallback() function is called and I open EP0 in and out :

    HAL_PCD_EP_Open(hpcd, 0x00, 64, EP_TYPE_CTRL);
    HAL_PCD_EP_Open(hpcd, 0x80, 64, EP_TYPE_CTRL);
Next, the HAL_PCD_SetupStageCallback() function is called and I'm supposed to respond to requests from the PC (USB host). Unfortunately, before calling this function, in the PCD_EP_ISR_Handler() function (line 1605 in file stm32u0xx_hal_pcd.c) :
/* Get SETUP Packet *
ep->xfer_count = PCD_GET_EP_RX_CNT(hpcd->Instance, ep->num);
Always returns 0, as if no request had been received.
 
How do I do it?
 
0 REPLIES 0