Hello Michaela,
ADC multimode (dual mode) is supported by STM32CubeMX2 HAL drivers, but not yet by UI interface.
It will be available in release 2.2.0.
In the meantime, you can use multimode with:
1. In UI, configure both ADC instances targeted for multimode (typically, ADC1 and ADC2).
It will generate configuration code (mx_adc1_init(), mx_adc2_init()).
2. In your application code, add multimode configuration:
hal_adc_handle_t *p_hadc_multimode_master = mx_adc1_gethandle(); // or mx_adc1_init() if not already called
hal_adc_handle_t *p_hadc_multimode_slave = mx_adc2_gethandle(); // or mx_adc2_init() if not already called
/* Link ADC handles */
if (HAL_ADC_SetLinkNextHandle(p_hadc_multimode_master, p_hadc_multimode_slave) != HAL_OK)
{
return EXEC_STATUS_ERROR;
}
/* Multimode: configured by ADC master only */
adc_mm_config.mode = HAL_ADC_MM_DUAL_REG_INTERL;
adc_mm_config.reg_data_format = HAL_ADC_MM_REG_DATA_PACK_32_BITS;
adc_mm_config.reg_data_transfer_packing = HAL_ADC_MM_REG_DATA_TRANSFER_UNPACK;
adc_mm_config.interl_delay = HAL_ADC_MM_INTERL_DELAY_12CYCLES;
if (HAL_ADC_MM_SetConfig(p_hadc_multimode_master, &adc_mm_config) != HAL_OK)
{
return EXEC_STATUS_ERROR;
}
3. Continue with process code:
HAL_ADC_MM_Start(p_hadc_multimode_master);
HAL_ADC_MM_Calibrate(p_hadc_multimode_master);
HAL_ADC_MM_REG_StartConv_DMA(...)
Additionally, you can find an example of ADC multimode:
From https://dev.st.com/stm32-example-library, search "multimode_simultaneous_dma_multi_buffers":
https://github.com/STMicroelectronics/STM32CubeC5/tree/main/examples/hal/adc/multimode_simultaneous_dma_multi_buffers
Best regards
Philippe