Skip to main content
Darius B
Associate II
March 2, 2018
Solved

STM32L4 USB double buffer HAL bug

  • March 2, 2018
  • 3 replies
  • 859 views
Posted on March 02, 2018 at 11:30

After some days investigation and debugging, I found bug at HAL definition.

Project was generated with CubeX v4.24, STM32L4 package version 1.11.0

@file    stm32l4xx_hal_pcd.h

#if 1 //darius

#define PCD_SET_EP_DBUF1_CNT(USBx, bEpNum, bDir, wCount)  { \

    if((bDir) == PCD_EP_DBUF_OUT)\

    {/* OUT endpoint */                                       \

      PCD_SET_EP_RX_CNT((USBx), (bEpNum),(wCount));           \

    }                                                         \

    else if((bDir) == PCD_EP_DBUF_IN)\

    {/* IN endpoint */                                        \

      *PCD_EP_RX_CNT((USBx), (bEpNum)) = (uint32_t)(wCount); \

    }                                                         \

  } /* SetEPDblBuf1Count */

#else// error her below

#define PCD_SET_EP_DBUF1_CNT(USBx, bEpNum, bDir, wCount)  { \

    if((bDir) == PCD_EP_DBUF_OUT)\

    {/* OUT endpoint */                                       \

      PCD_SET_EP_RX_CNT((USBx), (bEpNum),(wCount));           \

    }                                                         \

    else if((bDir) == PCD_EP_DBUF_IN)\

    {/* IN endpoint */                                        \

      *

PCD_EP_TX_CNT

((USBx), (bEpNum)) = (uint32_t)(wCount); \

    }                                                         \

  } /* SetEPDblBuf1Count */

#endif

Note:

Not found this bug at stm32L0 HAL  at file  stm32l0xx_hal_pcd.h ! Its Ok her and same like my correction.

#define PCD_SET_EP_DBUF1_CNT(USBx, bEpNum, bDir, wCount)  { \

    if(bDir == PCD_EP_DBUF_OUT)\

      /* OUT endpoint */ \

    {PCD_SET_EP_RX_CNT(USBx, bEpNum,wCount);}\

    else if(bDir == PCD_EP_DBUF_IN)\

      /* IN endpoint */\

      *PCD_EP_RX_CNT(USBx, bEpNum) = (uint32_t)wCount; \

  } /* SetEPDblBuf1Count */

I hope, then in next release this bug will be corrected in all packages.

BR

Darius Babrauskas

    This topic has been closed for replies.
    Best answer by Khouloud GARSI
    Posted on March 07, 2018 at 17:50

    Hi

    pavel_a

    ‌,

    This was also reported When an issue is highlighted on a Cube package, allother packages are also reviewed.

    Thank you both for your feedback. This helps us to enhance the quality of our resources.

    Khouloud.

    3 replies

    Khouloud GARSI
    ST Employee
    March 7, 2018
    Posted on March 07, 2018 at 14:46

    Hello

    sqlsql

    ‌,

    Thanks for bringing this point to our attention. I have highlighted it internally and I will get back to you with any further update.

    Best regards,

    Khouloud.

    Pavel A.
    March 7, 2018
    Posted on March 07, 2018 at 15:47

    Same in F0 library, ver, 1.9.0

    STM32Cube_FW_F0_V1.9.0\Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pcd.h, line 776

    --pa

    Khouloud GARSI
    Khouloud GARSIBest answer
    ST Employee
    March 7, 2018
    Posted on March 07, 2018 at 17:50

    Hi

    pavel_a

    ‌,

    This was also reported When an issue is highlighted on a Cube package, allother packages are also reviewed.

    Thank you both for your feedback. This helps us to enhance the quality of our resources.

    Khouloud.