CubeMX: ADC and DMA initialized in the wrong order
STM32L010C6Tx
STM32CubeMX V 5.4.0
FW_L0 V1.11.2
When creating a new project that used the ADC with the DMA and some unrelated peripherals, cubeMX will generate the following initialization list in main:
/* Initialize all configured peripherals */
MX_ADC_Init();
MX_DMA_Init();
MX_TIM2_Init();
MX_TIM21_Init();
MX_GPIO_Init();
/* USER CODE BEGIN 2 */This is a bug - MX_DMA_Init() should be called before MX_ADC_Init(). The ADC init function will attempt to write the the DMA CCR1 register, but will fail because the DMA has not yet been initialized.