Skip to main content
Associate II
March 26, 2024
Solved

USB Device Code Generation for STM32CubeIDE Version: 1.14.1

Hello,

I am trying to create a HID device using the USB Device code generation in STM32CubeIDE Version: 1.14.1.

But I have a problem with my PC not recognizing it as a HID device.

MxCube.Version=6.5.0 is working fine and we have investigated the differences within the source code

Undoing the following changes worked correctly.

/**
* @brief Start the USB device
* @PAram hpcd PCD handle
* @retval HAL status
*/
HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd)
{

USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;

__HAL_LOCK(hpcd);

if (((USBx->CID & (0x1U << 8)) == 0U) &&

(hpcd->Init.battery_charging_enable == 1U))

if ((hpcd->Init.battery_charging_enable == 1U) &&
(hpcd->Init.phy_itface != USB_OTG_ULPI_PHY))
{
/* Enable USB Transceiver */
USBx->GCCFG |= USB_OTG_GCCFG_PWRDWN;
}

__HAL_PCD_ENABLE(hpcd);
(void)USB_DevConnect(hpcd->Instance);
__HAL_UNLOCK(hpcd);

return HAL_OK;
}

/////////////////////////////////////////////////////////////////////////////////////////////
What does this behavior mean?

 

Best regards

    This topic has been closed for replies.
    FBLBest answer
    ST Technical Moderator
    July 11, 2024

    Hi @forst 

    This issue has been solved [HAL][LL][USB] Fix device connection in case battery charging used wi… · STMicroelectronics/stm32h7xx_hal_driver@6dd7f0e (github.com)

     

    To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL

    1 reply

    FBLBest answer
    ST Technical Moderator
    July 11, 2024
    To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL