cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX 6.0.0 STM32Cube FW_L4 V1.16.0 Bug report

tsuna
Associate II

USB CDC is not properly recognized by Windows 10.

How to recover :

\Inc\usbd_conf.h

Source code change

/** Alias for memory allocation. */

//#define USBD_malloc malloc

#define USBD_malloc (USBD_CDC_HandleTypeDef *) USBD_static_malloc

/** Alias for memory release. */

//#define USBD_free free

#define USBD_free USBD_static_free

Source code addition

/* Exported functions -------------------------------------------------------*/

void *USBD_static_malloc(uint32_t size);

void USBD_static_free(void *p);

4 REPLIES 4

Hello @tsuna​ 

I did not understand your request, could you please give more details about the issue.

Best regards,

Nesrine

Could you please share your .ioc file to check the issue.

tsuna
Associate II

I was using STM32CubeMX 5.6.1 STM32Cube_FW_L4_V1.15.1. The project was working fine. After updating to STM32CubeMX 6.0.0 STM32Cube_FW_L4_V1.16.0, Windows10 no longer recognizes USB properly. Device Manager is showing an exclamation mark.

I compared the old USB code with the new USB code to find out what changed and when I rewrite it with the recovery code above, it works fine.

The project and *.IOC design are commercial and cannot be published.

I know how to recover, but it's very annoying because I have to rewrite the generated code every time I generate code in STM32CubeMX.

STM32CubeMX is a great tool for my work. I hope it will be fixed in the next release.

tsuna
Associate II

The cause close to the core is

1.I am using FreeRTOS,

The memory area allocation process executed in USBD_CDC_Init() hcdc =USBD_malloc(sizeof(USBD_CDC_HandleTypeDef));

2.STM32Cube_FW_L4_V1.15.1 uses task heap.

3.STM32Cube_FW_L4_V1.16.0 uses __heap_base.

Since STM32CubeMX was updated, Heap_Size was insufficient and a problem occurred.

solution

1. Notify the programmer that the location of dynamic memory allocation has changed. Or

2. Notify that the heap capacity is insufficient. Or

3. Generate code by adding sizeof(USBD_CDC_HandleTypeDef) to the default Heap_Size.