2015-02-08 05:05 AM
Steps to reproduce:
1) Create new project, select STM32F030C8Tx chip2) In Peripherials enable Vrefint Channel for ADC3) Click Configuration -> ADC, optionally configure ADC parameters, note that in the channel config Rank is preset to1
and cannot be changed4) Generate codeFollowing code will be generated to configure channel:/**Configure for the selected ADC regular channel to be converted.
*/ sConfig.Channel = ADC_CHANNEL_VREFINT; sConfig.Rank = 1; sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5; HAL_ADC_ConfigChannel(&hadc, &sConfig);It will failIS_ADC_RANK
assert inHAL_ADC_ConfigChannel
because provided Rank value is1
, and macro accepts onlyADC_RANK_NONE
orADC_RANK_CHANNEL_NUMBER
values:#define IS_ADC_RANK(WATCHDOG) (((WATCHDOG) == ADC_RANK_CHANNEL_NUMBER) || \
((WATCHDOG) == ADC_RANK_NONE)2015-02-16 01:52 PM
Hello,
This will be fixed in 4.7 with: sConfig.Rank = ADC_RANK_CHANNEL_NUMBER; Best regards