cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 Code Generation Bug?

JE
Associate III

Hi,

i just generated a project using the Device Configuration Tool (1.19.0). All works. But as soon as I enable 

"Generate peripheral initialisation as a pair of '.c/.h' files per peripheral" the hardware stands at:

static HAL_StatusTypeDef USB_CoreReset(USB_OTG_GlobalTypeDef *USBx)
{
  __IO uint32_t count = 0U;

  /* Wait for AHB master IDLE state. */
  do
  {
    count++;

    if (count > HAL_USB_TIMEOUT)
    {
      return HAL_TIMEOUT;
    }
  } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_AHBIDL) == 0U);

  count = 10U;

  /* few cycles before setting core reset */
  while (count > 0U)
  {
    count--;
  }

  /* Core Soft Reset */
  USBx->GRSTCTL |= USB_OTG_GRSTCTL_CSRST;

  do
  {
////loops forever here?!?!?!
    count++;

    if (count > HAL_USB_TIMEOUT)
    {
      return HAL_TIMEOUT;
    }
  } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST);

  return HAL_OK;
}

 I had no closer look into what is done differently. Just wanted to report the issue. Again, if everything is inside of main.c it works!

Also wanted to note, that if using separte files it removes the last user enterable code section inside of MX_GPIO_Init(), here:

  /* USER CODE BEGIN MX_GPIO_Init_2 */

  /* USER CODE END MX_GPIO_Init_2 */
}

 Please enable!

 

Thanks,

Juergen

2 REPLIES 2
Ghofrane GSOURI
ST Employee

Hello @JE 

Could you please provide your IOC for further investigation.

THX

GHofrane

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.

Sure!