2021-12-07 05:05 AM
When DMA is used, the MX_DMA_Init shall always be called before any other HAL_***_Init (where *** is any peripheral with a HW dependency on DMA init code).
A regression was detected in the previous STM32CubeMX version 6.3.0 (STM32CubeIDE Version: 1.7.0 ) generating a wrong order of initialization functions.
This issue was fixed in the latest STM32CubeMX version 6.4.0. Thus, newly created project with this version will generate the correct initialization functions order.
Because the calling order is saved into the ioc file, the misplacement call to MX_DMA_Init() remains the same when trying to migrate automatically an old project from a buggy old version to the fixed version. The order stays the same and the generated code will be unfunctional.
For any old ioc file created by any STM32CubeMX version up to 6.3.0 included, hereafter some steps to overcome this misbehavior:
Solved! Go to Solution.
2022-06-29 04:54 AM
Hello,
This issue is fixed in STM32CubeMX latest release.
V6.6.0 is now available under this Link.
Thanks for your contribution.
Sara.
2022-06-30 07:01 AM
Can confirm, this bug is not fixed in STM32Cube FW_H7 V1.10.0 :
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DTS_Init();
MX_RTC_Init();
MX_SPI2_Init();
MX_TIM1_Init();
MX_UART4_Init();
MX_ADC1_Init();
MX_DMA2D_Init();
MX_I2C1_Init();
MX_RNG_Init();
MX_TIM5_Init();
MX_TIM17_Init();
MX_ADC2_Init();
MX_COMP1_Init();
MX_UART5_Init();
MX_SDMMC2_SD_Init();
MX_TIM4_Init();
MX_UART8_Init();
MX_I2C2_Init();
MX_OCTOSPI2_Init();
MX_UART9_Init();
MX_CRC_Init();
MX_FATFS_Init();
MX_USB_DEVICE_Init();
MX_DMA_Init();
MX_TIM16_Init();
MX_TouchGFX_Init();
/* USER CODE BEGIN 2 */
workaround is manually editing to:
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DTS_Init();
MX_RTC_Init();
MX_DMA_Init();
MX_SPI2_Init();
MX_TIM1_Init();
MX_UART4_Init();
MX_ADC1_Init();
MX_DMA2D_Init();
MX_I2C1_Init();
MX_RNG_Init();
MX_TIM5_Init();
MX_TIM17_Init();
MX_ADC2_Init();
MX_COMP1_Init();
MX_UART5_Init();
MX_SDMMC2_SD_Init();
MX_TIM4_Init();
MX_UART8_Init();
MX_I2C2_Init();
MX_OCTOSPI2_Init();
MX_UART9_Init();
MX_CRC_Init();
MX_FATFS_Init();
MX_USB_DEVICE_Init();
MX_TIM16_Init();
MX_TouchGFX_Init();
/* USER CODE BEGIN 2 */
not that nice...
Florian
2022-07-06 05:15 AM
The problem still exists with CubeIDE V1.9.0 on STM32L4 V1.17.2
New aspect: I normally can modify the order of initializaiton in IOC file in "Project Manager" / "Advanced settings"
One can see, that some lines are "fixed" and cannot be modified like "clock" "GPIO" and "DMA".
The Line ADC1 cannot be moved either. For some reason, ADC1 is not allowed to be moved. Others can be moved.
It is possible to edit this sequence though, by editing the IOC-File "by hand".
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_CAN1_Init-CAN1-false-HAL-true,6-MX_DAC1_Init-DAC1-false-HAL-true,7-MX_I2C2_Init-I2C2-false-HAL-true,8-MX_ADC2_Init-ADC2-false-HAL-true,9-MX_SPI3_Init-SPI3-false-HAL-true,10-MX_TIM1_Init-TIM1-false-HAL-true,11-MX_TIM17_Init-TIM17-false-HAL-true,12-MX_TIM2_Init-TIM2-false-HAL-true,13-MX_UART5_Init-UART5-false-HAL-true,14-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false
Now it is correct
2022-07-06 06:55 AM
2022-07-06 06:56 AM
2022-07-06 07:43 AM
This seems to be a good solution at the moment.
I deleted the peripheral and added them again together with the DMA.
If you add the DMA at a later stage, the DMA might be in the wrong sequence.
This is good for simple peripherals like UART, SPI or I2C.
The problem is when the peripherals are complicated like SRAM or HDMI/LCD.
2022-07-07 02:50 AM
Hello @Florian Rösel ,
Did you migrate your project to the latest MX/IDE release (v6.6.0/ v1.10.0) with a wrong order or did you start a new project with the latest version?
Sara.
2022-07-07 02:57 AM
Hello @Johannes ,
The issue is fixed in CubeMX/IDE latest release (v6.6.0/ v1.10.0). Could you please update your MX/IDE and check the order.
If you are planning to migrate your project to the latest CubeIDE version please check this thread first.
Sara.
2022-07-07 02:59 AM
Hello @victagayun ,
Did you by any chance migrated your project to v1.10.0 with the wrong order or did you start a new project with the latest version?
Sara.
2022-07-10 10:59 PM
was able to reproduce this situation in both scenarios - migration AND new project creation.
@Johannes 's workaround and his manual editing was the same I did and for now it works. But the original Problem still exists, you have to check manually, if the order is correct.