cancel
Showing results for 
Search instead for 
Did you mean: 

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

nicolas b
Associate III
Posted on February 05, 2018 at 15:41

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

#cubemx-4.24 #automatic-code-generation #low-layer
2 REPLIES 2
nicolas b
Associate III
Posted on April 25, 2018 at 10:23

Still not working on STM32Cube FW_F4 V1.21.0 and CubeMx 4.25.0.

Houda GHABRI
ST Employee
Posted on April 30, 2018 at 14:06

nicolas.bonnec

Hi,

I confirm ,issue still exist in 4.0 and itwill be resolved next release.

regards,

Houda