2017-11-15 01:57 AM
Hi,
I have ADC set like so (Code generated by CubeMX):
sConfig.Channel = ADC_CHANNEL_1;
sConfig.Rank = 1;
sConfig.SamplingTime = ADC_SAMPLETIME_2CYCLES_5;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;�?�?�?�?�?�?�?�?�?�?�?�?
However this fails in
stm32l4xx_hal_adc.c file in function:
HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig)�?�?
Specifically assert on
assert_param(IS_ADC_REGULAR_RANK(sConfig->Rank));�?�?�?�?
I assume generated code should look like this:
sConfig.Rank = ADC_REGULAR_RANK_1;�?�?
Is this correct or am i missing something about this part of code?
Solved! Go to Solution.
2018-03-05 05:31 AM
Hello
Mohor_i_.Miha
andKramer.David
,This bug is fixed in the current CubeMX release (4.24).
Please upgrade your CubeMX release with the latest one if not already done.
BR. Jeanne
2017-11-16 11:14 AM
This seems to be a bug introduced in the L4 1.10 Cube library.
Previously, eachADC_REGULAR_RANK was defined like this:#define ADC_REGULAR_RANK_1 ((uint32_t)0x00000001) /*!< ADC regular conversion rank 1 */�?
so it was fine that the generated code was
sConfig.Rank = 1;
But now is defined like this:
#define ADC_REGULAR_RANK_1 (LL_ADC_REG_RANK_1) /*!< ADC group regular sequencer rank 1 */�?
with
LL_ADC_REG_RANK_1 as
#define LL_ADC_REG_RANK_1 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_1_SQRX_BITOFFSET_POS)
...
#define ADC_SQR1_REGOFFSET (0x00000000U)
...
#define ADC_REG_RANK_1_SQRX_BITOFFSET_POS ( 6U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ1) */�?�?�?�?�?
Your fix will work...until you regenerate the code with STM32CubeMX. It is really something that ST should fix.
2017-11-16 12:32 PM
Thank you for confirming my problem.
I should have compared code with earlier releases of FW before posting questions.I know they have lots of MCUs to test for each FW release, but i do hope STM manages to reduce number of new bugs in FW updates...
2017-11-20 02:23 AM
Hello,
Thanks for report this issue. I raised this internally to CubeMx team to be fix in the coming release.
Best Regards
Imen
2018-03-05 05:31 AM
Hello
Mohor_i_.Miha
andKramer.David
,This bug is fixed in the current CubeMX release (4.24).
Please upgrade your CubeMX release with the latest one if not already done.
BR. Jeanne