2022-11-22 07:54 AM
I noticed that CubeMx (version 6.6.1 and earlier) when generating the code, may place the MX_DMA_Init() function after other ***_init functions that configure DMA registers. The problem is that those registers cannot be accessed 'before' enabling the DMA clock. For example here is a snippet of erroneous code:
MX_ADC1_Init();
MX_ADC3_Init();
MX_I2C2_Init();
MX_I2C3_Init();
MX_SPI1_Init();
MX_SPI2_Init();
MX_DMA_Init();
In the example above the ADC1 and ADC3 peripheral use the DMA mode, but the DMA is not initialized yet. In attachment there is the whole main.c file containing the above snippet.
A possible workaround could be to impose the clock initialization before any other initialization:
/* USER CODE BEGIN SysInit */
/* Workaround for a CubeMx bug */
__HAL_RCC_DMA2_CLK_ENABLE();
/* USER CODE END SysInit */
Solved! Go to Solution.
2022-11-22 08:05 AM
Hello @GZini.16 ;
First let me thank you for posting.
I assume this is the exact same issue already reported to the development team and tracked by the
Internal ticket number: 132093
(This is an internal tracking number and is not accessible or usable by customers).
and that will be fixed as soon as possible.
I will keep you posted with updates.
Thx
Ghofrane
2022-11-22 08:05 AM
Hello @GZini.16 ;
First let me thank you for posting.
I assume this is the exact same issue already reported to the development team and tracked by the
Internal ticket number: 132093
(This is an internal tracking number and is not accessible or usable by customers).
and that will be fixed as soon as possible.
I will keep you posted with updates.
Thx
Ghofrane
2022-11-22 03:07 PM
No hurry, just 3 and a half years have passed...