cancel
Showing results for 
Search instead for 
Did you mean: 

mistake in stm32f3xx_hal_pcd.c

thln47
Associate III
Posted on December 08, 2015 at 10:56

Hi,

STM32Cube_FW_F3_V1.3.0\Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pcd.c

In the function below:

static HAL_StatusTypeDef PCD_EP_ISR_Handler(PCD_HandleTypeDef *hpcd)

    ...

line 455:

        /*multi-packet on the NON control OUT endpoint*/

        ep->xfer_count+=count;

        ep->xfer_buff+=count;

       

        if ((ep->xfer_len == 0) || (count < ep->maxpacket))

        {

          /* RX COMPLETE */

          HAL_PCD_DataOutStageCallback(hpcd, ep->num);

        }

        else

        {

          HAL_PCD_EP_Receive(hpcd, ep->num, ep->xfer_buff, ep->xfer_len);

        }

        

        

the condition ((ep->xfer_len == 0) || (count < ep->maxpacket)) is always true because count is always lower than ep->maxpacket. So the HAL_PCD_DataOutStageCallback is always called!

 

This mistake has little consequence, but this requires that the assembly of multi-packets are done at the highest level.

#usb #stm32cube
1 REPLY 1
Posted on December 10, 2015 at 10:42

Hi ln.thierry,

This case is used when the host requests more than maxpacket. So, this code manages the multi-packet on the OUT endpoint,which means the size can be more than the maxpacket. 

-Shahrzad-