AnsweredAssumed Answered

STM CubeMX32 F4xx rel. 1.5.0: Issue with ADC Code generation (Bug?)

Question asked by Avizzano.Carlo_Alber on Apr 27, 2015
Latest reply on May 25, 2015 by Avizzano.Carlo_Alber
Dear Developers,

First of all, thank you very much for the nice development environment who
really reduces the development time and increase the portability across the
whole uC series.

I noticed an apparent bug in the code generation when the user is programming DAC component with embedded sequencer feature.

In particular the BUG is related to the RANK programming which is not properly set. For instance. In particular it seems that the first RANK in the sequencer is mismatches with the overall number of ADC channels in the conversion. This is for instance the case of 3 sequence with 3 channels:

  sConfig.Channel = ADC_CHANNEL_1;
  sConfig.Rank = 3;
  sConfig.SamplingTime = ADC_SAMPLETIME_28CYCLES;
  HAL_ADC_ConfigChannel(&hadc1, &sConfig);

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

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


As you may see the rank is not properly set in the case of the first ADC conversion.
Now, I know that the BUG can easily be corrected by hand, by unfortunately
I am currently using CubeMX in a shared development environment with my own copy of simulink F4xx toolset, where the code generated by STMcube is
automatically imported and compiled into a simulink scheme, hence the error
is propagated directly in the executable.

I would be grateful if this behavior can be corrected in the next library version.

Kind regards and thank you in advance
C.Alberto Avizzano

PS: for more details I am available at c.avizzano@sssup.it

Outcomes