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-10-26 03:01 PM
Test with STM32CubeIDE v1.10.1 containing STM32CubeMX STMicroelectronics 6.6.1.202207061420, creating project for NUCLEO-H7232ZG to use DMA to move data from memory to USART3.
Initialization order created by STM32CubeMX is still wrong:
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ETH_Init();
MX_USART3_UART_Init();
MX_DMA_Init();
MX_USB_OTG_HS_USB_Init();
/* USER CODE BEGIN 2 */
In Project Manager - Advanced Settings - Generated Function Calls, the engry for MX_DMA_Init() is greyed out and cannot be moved, butthe MX_USART3_UART_Init() entry can be shifted down to correct the error.
2022-10-28 02:18 AM
Exact, same issue for CubeMX, V6.5.0
2022-11-06 03:51 AM
@CJans.1 provided a workaround, which may perhaps be a somewhat more persistent solution? I don't use Cube/CubeMX so can't judge.
JW
2023-02-01 12:08 AM
When you say not working, did you get zeros in the output? Or did you get in a deadlock?
2023-03-01 09:26 AM
@Sara BEN HADJ YAHYA I got the same issue with cubeMx 6.6.1
I cannot change the order , for some reason DMa is greyed out and TIM1 cannot be moved neither
For the others TIM3 and TIM17 , i am able to change positions
2023-03-01 09:29 AM
good luck with that
2023-03-01 09:30 AM
Not for me, aparently if you migrated the cubeMX from older versions DMA's place in the Advanced Settings menu cannot be changed
2023-03-01 09:32 AM
I do the same, to manually override initialization of the DMA, but every time i click autogenerate it tends to switch them back to the wrong order, it gets very tyring after a while.
2023-03-01 10:15 AM
You can edit the ioc file manually with a text editor.
Just look at this line:
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_CAN1_Ini...
Here you can modify the order of initialization.
You can move the DMA init to position 3 (change the numbers with it).
From now on, the CubeMX will generate correct code.
Johannes
2023-03-01 12:37 PM
Clearly you didn't even read the link Jan gave...