AnsweredAssumed Answered

[bug] CubeMX code generation, ADC injected, wrong rank/channel

Question asked by nicolas b on Feb 5, 2018
Latest reply on Apr 30, 2018 by houda ghabri

Hello,

 

I noticed a problem while trying to generate code with CubeMX, regarding injected ADC.

 

The problem appears as follow:

- Make a project with Cube on a Nucleo-F413ZH,

- Use default pin attribution,

- set PC0, 1, 2 to analog,

- configure 3 Conversions in ADC_Injected_ConversionMode,

- rank 1 -> channel 10, rank 2 -> channel 11, rank 3 -> channel 12,

- use Low Layer for ADC,

- generate code.

 


    /**Configure Injected Channel
    */
  ADC_INJ_InitStruct.TriggerSource = LL_ADC_INJ_TRIG_SOFTWARE;
  ADC_INJ_InitStruct.SequencerLength = LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS;
  ADC_INJ_InitStruct.SequencerDiscont = LL_ADC_INJ_SEQ_DISCONT_DISABLE;
  ADC_INJ_InitStruct.TrigAuto = LL_ADC_INJ_TRIG_INDEPENDENT;
  LL_ADC_INJ_Init(ADC1, &ADC_INJ_InitStruct);

  LL_ADC_INJ_SetSequencerRanks(ADC1, LL_ADC_INJ_RANK_1, LL_ADC_CHANNEL_10);

  LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_10, LL_ADC_SAMPLINGTIME_3CYCLES);

  LL_ADC_INJ_SetOffset(ADC1, LL_ADC_INJ_RANK_1, 0);

  LL_ADC_DisableIT_JEOS(ADC1);

    /**Configure Injected Channel
    */
  LL_ADC_INJ_Init(ADC1, &ADC_INJ_InitStruct);

  LL_ADC_INJ_SetSequencerRanks(ADC1, LL_ADC_INJ_RANK_1, LL_ADC_CHANNEL_11);

  LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_11, LL_ADC_SAMPLINGTIME_3CYCLES);

  LL_ADC_INJ_SetOffset(ADC1, LL_ADC_INJ_RANK_1, 0);

  LL_ADC_DisableIT_JEOS(ADC1);

    /**Configure Injected Channel
    */
  LL_ADC_INJ_Init(ADC1, &ADC_INJ_InitStruct);

  LL_ADC_INJ_SetSequencerRanks(ADC1, LL_ADC_INJ_RANK_1, LL_ADC_CHANNEL_12);

  LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_12, LL_ADC_SAMPLINGTIME_3CYCLES);

  LL_ADC_INJ_SetOffset(ADC1, LL_ADC_INJ_RANK_1, 0);

 

We see here that all channels are affected to rank 1.

 

Versions:

- STM32Cube V1.0, version 4.24.0,

- STM32Cube FW_F4 V1.19.0

Attachments

Outcomes