Skip to main content
robert-hartung
Associate III
August 14, 2015
Question

Bug in HAL_PCD_Init: Wrong HBSTLEN value

  • August 14, 2015
  • 2 replies
  • 981 views
Posted on August 14, 2015 at 22:23

I have been writing my own USB driver. While debugging an issue with the receive buffer/receive fifo I came across this issue.

I am using an STM32F205VCT processor with an external HS Phy (USB3300). The function HAL_PCD_Init calls the function USB_CoreInit and it will initialize the required registers. I am using DMA. So this code will be executed:

if(cfg.dma_enable == ENABLE)

  {

    USBx->GAHBCFG |= (USB_OTG_GAHBCFG_HBSTLEN_2 | USB_OTG_GAHBCFG_HBSTLEN_1);

    USBx->GAHBCFG |= USB_OTG_GAHBCFG_DMAEN;

  }

with

&sharpdefine USB_OTG_GAHBCFG_HBSTLEN_1               ((uint32_t)0x00000004)            /*!<Bit 1 */

&sharpdefine USB_OTG_GAHBCFG_HBSTLEN_2               ((uint32_t)0x00000008)            /*!<Bit 2 */

Unfortunately, this will be evaluated to be ''0b1100'' and will be or'd onto the register. Resulting in a value of ''0b0110'' for the HBSTLEN value. Unfortunately, this is an invalid value, but no error is thrown!

Can someone verify this? The Code was initially generated with the latest version of cubemx!

If you would like to get more information on my USB Driver, just let me know.

#usb #hal #!bug
This topic has been closed for replies.

2 replies

Nesrine M_O
Associate
August 17, 2015
Posted on August 17, 2015 at 13:25

Hi,

I will check this problem with our development team & come back to you.

Sorry for the inconvenience may bring.

-Syrine-

Nesrine M_O
Associate
December 23, 2015
Posted on December 23, 2015 at 14:30

Hi Robert,

Your reported issue is confirmed by our team and will be fixed in coming release of the STM32cubeF2 package.

Thank you very much for your contribution to the enhancement of our STM32 related solutions.

-Syrine-