cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7A3 Nucleo-144 ATM32H7A3ZITQ6, USB USB_CoreReset fails

Marius CO
Associate III

I Am facing another issue with this board.

Her is my USB setting

  • USB_OTG_HS is Device Only
    • NVIC Settings
      • USB OTG EndPoint In/Out 1 INT checked
      • GLobal Int checked
  • USB Device
    • Class Virtual Port

Then the init fails in USB_CoreReset with timeout.

I checked the HAL_PCD_MspInit and pins looks OKay.

static HAL_StatusTypeDef USB_CoreReset(USB_OTG_GlobalTypeDef *USBx)
{
  __IO uint32_t count = 0U;
 
  /* Wait for AHB master IDLE state. */
  do
  {
    count++;
 
    if (count > 200000U)
    {
      return HAL_TIMEOUT;
    }
  } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_AHBIDL) == 0U);
 
  /* Core Soft Reset */
  count = 0U;
  USBx->GRSTCTL |= USB_OTG_GRSTCTL_CSRST;
 
  do
  {
    count++;
 
    if (count > 200000U)
    {
      return HAL_TIMEOUT; <<<<<<<<<<<<<  FAILS
    }
  } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST);
 
  return HAL_OK;
}

I just discovered that My USB config

 /**USB_OTG_HS GPIO Configuration
    PC0     ------> USB_OTG_HS_ULPI_STP
    PC2_C     ------> USB_OTG_HS_ULPI_DIR
    PC3_C     ------> USB_OTG_HS_ULPI_NXT
    PA3     ------> USB_OTG_HS_ULPI_D0
    PA5     ------> USB_OTG_HS_ULPI_CK
    PB0     ------> USB_OTG_HS_ULPI_D1
    PB1     ------> USB_OTG_HS_ULPI_D2
    PB10     ------> USB_OTG_HS_ULPI_D3
    PB11     ------> USB_OTG_HS_ULPI_D4
    PB12     ------> USB_OTG_HS_ULPI_D5
    PB13     ------> USB_OTG_HS_ULPI_D6
    PA8     ------> USB_OTG_HS_SOF
    PB5     ------> USB_OTG_HS_ULPI_D7

The PA5 USB_OTG_HS_ULPI_CK

as

    GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_5;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF10_OTG1_HS;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
[...]
    __HAL_RCC_USB_OTG_HS_CLK_ENABLE();
    __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();

I verified with the Ossciloscope and PA5 [USB_OTG_HS_ULPI_CK]

does not have a clock.

I tried on 2 boards, and I dont think both boards are deffective.

Any help would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Marius CO
Associate III

FIXED!

I started another project from scratch and at the step after selecting the board

wher asked to keep defaults I let it go.

On initial project I started on a clean slate because the code was working on STM32G474

with a clean slate project, where I start from scratch configuring the pins.

Unfortunately it did not work for STM32H7A3.

View solution in original post

1 REPLY 1
Marius CO
Associate III

FIXED!

I started another project from scratch and at the step after selecting the board

wher asked to keep defaults I let it go.

On initial project I started on a clean slate because the code was working on STM32G474

with a clean slate project, where I start from scratch configuring the pins.

Unfortunately it did not work for STM32H7A3.