2017-03-15 01:59 AM
I discovered CubeMX 4.20 always generates code where VBUS sensing is enabled, no matter if it is ticked in CubeMX or not. This caused enumeration fails in several projects where PA9 is not used by me (I use it in CDC Virtual Com Port mode)
Affected code file is usbd_conf.c line 299 (line 18 in snippet)
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
{
/* Init USB_IP */
if (pdev->id == DEVICE_FS) {
/* Link The driver to the stack */
hpcd_USB_OTG_FS.pData = pdev;
pdev->pData = &hpcd_USB_OTG_FS;
hpcd_USB_OTG_FS.Instance = USB_OTG_FS;
hpcd_USB_OTG_FS.Init.dev_endpoints = 4;
hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_OTG_FS.Init.dma_enable = DISABLE;
hpcd_USB_OTG_FS.Init.ep0_mps = DEP0CTL_MPS_64;
hpcd_USB_OTG_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
hpcd_USB_OTG_FS.Init.low_power_enable = DISABLE;
hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE;
hpcd_USB_OTG_FS.Init.vbus_sensing_enable = ENABLE; // <= IT SHOULD BE DISABLED !!!
hpcd_USB_OTG_FS.Init.use_dedicated_ep1 = DISABLE;
if (HAL_PCD_Init(&hpcd_USB_OTG_FS) != HAL_OK)
{
Error_Handler();
}
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80);
}
return USBD_OK;
}
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
Took me a while. Please fix it, also fix the annoying RCC Init Bug and the 'does not build in STM32 System Workbench because we forgot to put the 'attribute weak' in hypens-bug'.
It is really annoying to correct this after each minor change in CubeMX.
Markus
#cube-mx #stm32cube-bug #usb-vbus2017-03-15 02:36 AM
Hi
Rudolf.Markus
,Thank you for your feedback. The issue has been reportedto our MX team for checking.
-Nesrine-
2017-04-07 09:44 AM
Is this by chance fixed in 4.20.1? The change log is basically worthless:
'Fixed regression in the management of peripherals parameters default value.'
That is so vacuous.
It would be really helpful to provide links to the discussed issues in the forum in the change log or provide some kind of bug tracking system for the CubeMX.
2017-04-21 03:03 PM
I can agree this - it's not fixed yet.
2017-08-31 05:44 AM
Hi,
Generating project from CubeMx with STM32F407ZETx mcu reference and STM32Cube FW_F4 V1.16.0 firmware package did not reproduce the issue.
vbus_sensing_enable is correctly set to DISABLE in accordance with 'VBUS sensing' selected as 'Disable' in USB_OTG_FS_Configuration UI panel.
Regards.Cyril
2018-04-12 03:00 AM
Hi
Rudolf.Markus
, May you confirm that the problem is solved also your side? Thanks in advance for helping to complete this thread. Regards. Cyril2018-04-12 05:06 AM
I'm working on different projects right now, but I'm spinning a revision 2 of the affected board / firmware which is in production already. I will test then with the latest Cube and will report back. But it will take me some time.
2018-04-12 05:07 AM
Which CubeMX version did u test with so I can reproduce it's fixed? I think firmware version is a different story than CubeMx version?