CubeMX generates wrong ADC code for F0 family when using Vrefint or Temperature channels
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-02-08 5:05 AM
Posted on February 08, 2015 at 14:05
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)
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-02-16 1:52 PM
Posted on February 16, 2015 at 22:52
Hello,
This will be fixed in 4.7 with: sConfig.Rank = ADC_RANK_CHANNEL_NUMBER; Best regards