cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX 4.7.0 Bug Report - ADC1 code generation, wrong rank

Posted on March 24, 2015 at 16:46

tl;dr - after converting your project to 4.7.0 check all of the generated code carefully.

I have ADC1 set up so that ranks 1-4 are hooked to channels 0-3 respectively, rank 5 is hooked to vbat, and rank 6 is hooked to the temperature sensor. The code generated for ranks 2-6 are correct, but rank 1 is generated as a second instance of rank 5, with the correct channel. The code generated in 4.6.0 was:

/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time. 
*/
sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = 1;
HAL_ADC_ConfigChannel(&hadc1, &sConfig);

in 4.7.0 reads:

/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time. 
*/
sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = 5;
HAL_ADC_ConfigChannel(&hadc1, &sConfig);

2 REPLIES 2
Posted on March 24, 2015 at 16:50

I just noticed that the generation of code for ADC2 does exactly the same thing. Instead of using 

  sConfig.Rank = 1;

Cube generates

  sConfig.Rank = 5;

stm32cube-t
Senior III
Posted on March 31, 2015 at 16:25

Hello, we confirm the issue and it will be fixed in next MX release 4.8.

Thank you.