cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_PCD PCD_GET_EP_RX_CNT only return 0

frangipane
Associate

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?
 
1 REPLY 1
FBL
ST Employee

Hi @frangipane 

Your device is still not addressed at this stage! 

Do you have an issue using cube firmware example? Otherwise would you attach minimum project to reproduce the issue if present?

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.