STM32Cube  Version 2.0
Create Projects for STM32F2 Series with STM32Cube HAL and STM32CubeMX
 All Files Pages
Troubleshooting

The section Troubleshooting gives you hints for fixing issues that could occur when using STM32CubeMX.

CMSIS-RTOS RTX: Stack overflow in main thread

There is no functionality implemented in the 'main' thread, but adding new peripherals with STM32CubeMX exceeds already the available stack for the 'main' thread. Is this correct?

The Cortex-M4 and Cortex-M7 implement an FPU and a context switch requires already significant stack space. In addition, the STM32Cube HAL uses structures that are allocated at the stack. Therefore, the recommended setting for the Main Thread stack size is 1024 bytes.

CMSIS-RTOS RTX: Application sporadically stops working

The application uses CMSIS-RTOS RTX but during execution it shows sporadic problems and sometimes stops working.

CMSIS-RTOS RTX requires that the System Tick Interrupt has the lowest priority. When working with 4-bit group priority, the setting for TICK_INT_PRIORITY should be 0x0F. Verify the section System Configuration in the file stm32fxxx_hal_conf.h. When using STM32CubeMX for configuration, refer to Add CMSIS-RTOS RTX for more information.

/* ########################### System Configuration ######################### */
#define TICK_INT_PRIORITY ((uint32_t)0x0F)

Compile Errors after adding Components through the Run-Time Environment that are not configured with STM32CubeMX

Certain components (mainly Board Support) already contain initialization code and do not require to be configured with STM32CubeMX. After adding such a component through the Run-Time Environment, the build process fails indicating undefined identifiers. Example:

error: #20: identifier "UART_HandleTypeDef" is undefined

The file stm32f7xx_hal_conf.h needs to be manually updated to enable the missing peripheral. Open the file in the editor and un-comment the module (in this case the UART module).

:
#define HAL_UART_MODULE_ENABLED // un-comment this define!
:

L6200E: Symbol SysTick_Handler multiply defined (by hal_cm4.o and stm32fxxx_it.o)

The CMSIS-RTOS RTX real-time operating system requires control of the SysTick_Handler function. Remove the function SysTick_Handler in the module stm32fxxx_it.c and add the code below to your project:

extern uint32_t os_time;
uint32_t HAL_GetTick(void) {
return os_time;
}
Note
Refer to Add CMSIS-RTOS RTX for more information.

Symbol xxx_xx_IRQHandler multiply defined (by i2c_stm32f7xx.o and stm32f7xx_it.o)

CMSIS-Driver implement their own interrupt service routines. However, STM32CubeMX adds interrupt service routines for the peripherals that are configured.

It is required to remove the interrupt service routine from the file stm32fxxx_it.c as shown below for the I2C interrupt handler.

#if 0 // remove definition of the interrupt service routine.
void I2C1_EV_IRQHandler(void)
{
/* USER CODE BEGIN I2C1_EV_IRQn 0 */
/* USER CODE END I2C1_EV_IRQn 0 */
HAL_I2C_EV_IRQHandler(&hi2c1);
/* USER CODE BEGIN I2C1_EV_IRQn 1 */
/* USER CODE END I2C1_EV_IRQn 1 */
}
#endif

Variables in off-chip RAM are not Initialized

The #define symbols DATA_IN_ExtSRAM and DATA_IN_ExtSDRAM configure the external memory bus interface in the CMSIS-CORE file system_stm32fxxx.c. Access to the external memory must be setup using these define symbols to ensure that the compiler initialization that executes before 'main' can access external (or off-chip) RAM.

STM32CubeMX Fails to start

This problem occurs when a project folder name contains a blank or space (' '). It is a known limitation of the current implementation and will be fixed in MDK v5.17.

STM32CubeMX Freezes on click of "Open Folder" after Generate Project Reports

STM32CubeMX may freeze after using the menu command Project - Generate Report and the button Open Folder.

OpenGenReports.png

Work-around: open the folder manually using the Windows Explorer.