AnsweredAssumed Answered

CubeMX 4.24.0 bug report: ADC sequencer length set incorrectly when using LL

Question asked by Antti Huhtala on Feb 26, 2018

Generating code on CubeMX 4.24.0 for STM32F100RB using LL (STM32Cube FW_F1 V1.6.0), when setting up the ADC for a 2 conversion sequence, the generated code looks like the following:

ADC_REG_InitStruct.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE;
ADC_REG_InitStruct.SequencerLength = 2;
ADC_REG_InitStruct.ContinuousMode = LL_ADC_REG_CONV_SINGLE;
LL_ADC_REG_Init(ADC1, &ADC_REG_InitStruct);


Looks good initially, but unfortunately doesn't work. Only one conversion is actually performed. The reason is that SequencerLength should be configured with one of the ADC_LL_EC_REG_SEQ_SCAN_LENGTH group macros. That is, one of LL_ADC_REG_SEQ_SCAN_DISABLE, LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS, LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS etc. These indeed take on values very different from 2, 3, 4 etc.


Changing the sequencer length manually to the proper value of LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS fixes the problem.