Add DMA initialize routine( for example, HAL_ADCDMA_SetRegs(&hadc)) after MX_DMA_Init()
Then "STM32CubeIDE basics - 10 ADC DMA TIM HAL lab" video sample can works well.
code sample (1) (2)
By the way, I finally used ADC sequential discontinuous mode for each 1ms ADC start by (3) in sysclock interrupt service routine after HAL_ADC_Start_DMA.
----------------------------------------
(1)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC_Init();
MX_DMA_Init();
/* USER CODE BEGIN 2 */
HAL_ADCDMA_SetRegs(&hadc);
---------------------------------------
(2)
---- Somewhere in user program ------------------------------------
tmp |= ((uint32_t) ( DMA_CCR_MINC | DMA_CCR_PSIZE_0 | DMA_CCR_MSIZE_1)); /* half word peripheral and full word memory( DMA_CCR_MSIZE_1 depends on destination memory size) */
hadc->DMA_Handle->Instance->CCR = tmp;
return HAL_OK;
}
-----------------------------------------
(3) use HAL_ADC_SWTrig, if you want to trigger ADC in discontinuous mode.