Skip to main content
johan239955
Associate
March 13, 2017
Solved

Bugreport STM32CubeMX 4.20

  • March 13, 2017
  • 4 replies
  • 1276 views
Posted on March 13, 2017 at 15:52

1. Faulty code generation

STMCube Generates to following code in the function: void SystemClock_Config(void)

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;�?

this results that the SystemClock_Config function always enters the Error_Handler

HSE Clock is used as main clock.

By removing the RCC_OSCILATORTYPE_HSI define code functions normally

2. Non working code USB MSC

Code generated for USB MSC stops working after the usb command USB Set Configuration Request

Device Manager reports Error Code 10 (can't start device)

The usb analyzer tool of wireshark shows no communication after host sends Set Configuration Request.

Problem observed from at least STM32CubeMX V4.18+

Changing driver versions does not solve the isuue

Tested on STM32446e-Eval and STM23F446ZC

PC: Windows 10 Toolchain: KEIL µVsion V5 #stm32cube-bug #bug-stm32cubemx
This topic has been closed for replies.
Best answer by Jeanne Joly
Posted on April 28, 2017 at 09:24

Hello all,

Sorry for our late answer.

I would inform you that this issue is fixed in

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

  V 4.20.1.

Sorry for any inconvenience this may cause you.

BR. Eric

4 replies

Nesrine M_O
Associate
March 13, 2017
Posted on March 13, 2017 at 16:09

Hi

Zwarteveld.Johan

,

Thank you for your feedback. The issue has been reported to our MX team for check..Sorry for the inconvenience it may bring.

-Nesrine-

johan239955
Associate
March 17, 2017
Posted on March 17, 2017 at 12:03

For future reference :

2. Non working code USB MSC

Code generated for USB MSC stops working after the usb command USB Set Configuration Request

Device Manager reports Error Code 10 (can't start device)

The usb analyzer tool of wireshark shows no communication after host sends Set Configuration Request.

Problem observed from at least STM32CubeMX V4.18+

STM32CubeMx generates:

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 = 6;
 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;
 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;
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

if the following line is changed from:

hpcd_USB_OTG_FS.Init.dev_endpoints = 6;�?�?

to

hpcd_USB_OTG_FS.Init.dev_endpoints = 4;�?�?

the code start working again and my OS recognizes the device as mass storage.

is suspect that the set configuration command fails because there are an additional 2 uninitialized / unused endpoints

Please include the mentioned abnormalities in the next update

ayarema
Associate II
March 17, 2017
Posted on March 17, 2017 at 19:21

THANK YOU for posting this. Spent like 3 days measuring everything electrically trying to figure out why an HSE was not being selected. This bug is the reason, now works like a charm.

afay ge
Visitor II
March 30, 2017
Posted on March 30, 2017 at 14:53

Thanks a lot, change 4 boards, 2 IDEs 

µVsion and SW4STM32, HSE still not work, Now running good.

Jeanne Joly
Associate
April 28, 2017
Posted on April 28, 2017 at 09:24

Hello all,

Sorry for our late answer.

I would inform you that this issue is fixed in

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

  V 4.20.1.

Sorry for any inconvenience this may cause you.

BR. Eric