cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeF0 bugreport (HAL, USB, VCP)

justdanpo
Associate
Posted on August 06, 2014 at 09:00

Bug 1:

STM32Cube_FW_F0_V1.0.0\Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pcd.h

typedef
struct
{
PCD_TypeDef *Instance; 
/*!< Register base address */
PCD_InitTypeDef Init; 
/*!< PCD required parameters */
__IO uint8_t USB_Address; 
/*!< USB Address */
PCD_EPTypeDef IN_ep[5]; 
/*!< IN endpoint parameters */
PCD_EPTypeDef OUT_ep[5]; 
/*!< OUT endpoint parameters */
HAL_LockTypeDef Lock; 
/*!< PCD peripheral status */
__IO PCD_StateTypeDef State; 
/*!< PCD communication state */
uint32_t Setup[12]; 
/*!< Setup packet buffer */
void
*pData; 
/*!< Pointer to upper stack Handler */
} PCD_HandleTypeDef;

Here is a typo. Size of IN_ep and OUT_ep must be 15 (or at least not less thanhpcd_USB_FS.Init.dev_endpoints). Bug2: After I send more than 6-8 bytes per packet at once from or to MCU, PC starts to receive rubbish instead of data sent by MCU. I've discovered usbd_conf.c/USBD_LL_Init() configures data buffer pointers

HAL_PCDEx_PMAConfig(pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
HAL_PCDEx_PMAConfig(pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);

but not sets them forCDC_IN_EP (0x81) andCDC_OUT_EP (0x01). I've replaced this code by the following and that fixed the problem:

HAL_PCDEx_PMAConfig(pdev->pData , 0x00 , PCD_SNG_BUF, 0x18+0*USB_FS_MAX_PACKET_SIZE);
HAL_PCDEx_PMAConfig(pdev->pData , 0x80 , PCD_SNG_BUF, 0x18+1*USB_FS_MAX_PACKET_SIZE);
HAL_PCDEx_PMAConfig(pdev->pData , 0x01 , PCD_SNG_BUF, 0x18+2*USB_FS_MAX_PACKET_SIZE);
HAL_PCDEx_PMAConfig(pdev->pData , 0x81 , PCD_SNG_BUF, 0x18+3*USB_FS_MAX_PACKET_SIZE);

Bug3:

After about 20-30 packets PC receives data it sent instead of data MCU replied with.

2 REPLIES 2
ezhang
Associate
Posted on October 10, 2014 at 08:22

Thank you for your bug report. I encountered the same issue. After add

HAL_PCDEx_PMAConfig

for all endpoints, the corrupted report issue disappeared.

Posted on October 20, 2014 at 15:26

Hi all,

Thanks for the feedback. This limitation is already noted within the STM32Cube L0 HAL bugs list, and will be fixed in next releases.

Regards,

Heisenberg.