cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX generates extra MultiMode config for slave channel that causes init fail

devinw
Associate III

I'm setting up Dual Regular Simultaneous mode on my STM32H533RE and I cane across a problem. When the code is gerated, both MX_ADC1_Init() and MX_ADC2_Init() end up with this:

 

/** Configure the ADC multi-mode
*/
// multimode.Mode = ADC_DUALMODE_REGSIMULT;
// multimode.DMAAccessMode = ADC_DMAACCESSMODE_12_10_BITS;
// multimode.TwoSamplingDelay = ADC_TWOSAMPLINGDELAY_1CYCLE;
// if (HAL_ADCEx_MultiModeConfigChannel(&hadc2, &multimode) != HAL_OK)
// {
// Error_Handler();
// }
 
WhereHAL_ADCEx_MultiModeConfiChannel expects MASTER as the first argument.
 
So when I start up, ADC1 inits fine, but ADC2 fails because it tries to run that above function
with hadc2 as the master, even though it is a slave, and has a HAL config error.
 
If I comment out the above block on MX_ADC2_Init, all seems to work well.
 
 
Is this a bug? Or can I do something different in CubeMX to make this not happen?
2 REPLIES 2
Mahmoud Ben Romdhane
ST Employee

Hello @devinw ,

First let me thank you for posting.

For more investigation, I suggest please that you provide your Ioc.File.

Thanks.

Mahmoud

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks for looking into it. IOC file is attached.

 

-Devin