STM32CubeIDE generates reproducible erroneous code for the STM32L412 Nucleo-64 using ADC1 or ADC2 after a recent update to 1.7.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-17 1:13 AM
STM32CubeIDE
Version: 1.7.0
Build: 10852_20210715_0634 (UTC)
In AL_ADC_MspInit an erroneos line is generated after a recent update of STM32CubeIDE and has to be commented out:
PeriphClkInit.AdcClockSelection = ADCCLockSelection;
The following error message is generated
../Core/Src/stm32l4xx_hal_msp.c: In function 'HAL_ADC_MspInit':
../Core/Src/stm32l4xx_hal_msp.c:107:18: error: 'RCC_PeriphCLKInitTypeDef' {aka 'struct <anonymous>'} has no member named 'AdcClockSelection'; did you mean 'I2c1ClockSelection'?
107 | PeriphClkInit.AdcClockSelection = ADCCLockSelection;
| ^~~~~~~~~~~~~~~~~
| I2c1ClockSelection
../Core/Src/stm32l4xx_hal_msp.c:107:38: error: 'ADCCLockSelection' undeclared (first use in this function); did you mean 'SdioClockSelection'?
107 | PeriphClkInit.AdcClockSelection = ADCCLockSelection;
| ^~~~~~~~~~~~~~~~~
| SdioClockSelection
../Core/Src/stm32l4xx_hal_msp.c:107:38: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Core/Src/subdir.mk:40: Core/Src/stm32l4xx_hal_msp.o] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.
Solved! Go to Solution.
- Labels:
-
ADC
-
STM32CubeIDE
-
STM32CubeMX
-
STM32L4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-02 2:55 AM
Hi @MMart.20​ & @MWest.2​ ,
This is confirmed to be a limitation in STM32CubeMX 6.3.0.
A complete explanation is provided by @Khouloud OTHMAN​ in this discussion.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-19 5:37 AM
Hello,
I am getting the same error after the latest update. I hope they push a fix soon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-30 5:06 AM
Hi again,
I've had some time to look into this and the STM32L412's ADCs take their clocks from the SYSCLK, so the clock selection would not have any effect (other STM32L4xx can have different ADC clock sources, so they would have a clock mux in there). You can comment out the "PeriphClkInit.AdcClockSelection = ADCCLockSelection;" line and the ADC will still have its clock.
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-02 2:55 AM
Hi @MMart.20​ & @MWest.2​ ,
This is confirmed to be a limitation in STM32CubeMX 6.3.0.
A complete explanation is provided by @Khouloud OTHMAN​ in this discussion.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-21 10:10 AM
I am brand new to STM32Cube and STM32 in general. I've got a NUCLEO-L412KB. I'm running STM32CubeIDE, Version: 1.7.0, Build: 10852_20210715_0634 (UTC). For my first project, I did New, STM32 Project, selected STM32L412KB, and in Pinouts and Configuration, selected ADC1, and clicked Temperature Sensor Channel. I then saved with generate code, and clicked build. It dies on this:
arm-none-eabi-gcc "../Core/Src/stm32l4xx_it.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32L412xx -c -I../Core/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/stm32l4xx_it.d" -MT"Core/Src/stm32l4xx_it.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/stm32l4xx_it.o"
../Core/Src/stm32l4xx_hal_msp.c: In function 'HAL_ADC_MspInit':
../Core/Src/stm32l4xx_hal_msp.c:97:19: error: 'RCC_PeriphCLKInitTypeDef' {aka 'struct <anonymous>'} has no member named 'AdcClockSelection'; did you mean 'I2c1ClockSelection'?
97 | PeriphClkInit.AdcClockSelection = ADCCLockSelection;
| ^~~~~~~~~~~~~~~~~
| I2c1ClockSelection
../Core/Src/stm32l4xx_hal_msp.c:97:39: error: 'ADCCLockSelection' undeclared (first use in this function); did you mean 'SdioClockSelection'?
97 | PeriphClkInit.AdcClockSelection = ADCCLockSelection;
| ^~~~~~~~~~~~~~~~~
| SdioClockSelection
../Core/Src/stm32l4xx_hal_msp.c:97:39: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Core/Src/subdir.mk:34: Core/Src/stm32l4xx_hal_msp.o] Error 1
make: *** Waiting for unfinished jobs....
"make -j4 all" terminated with exit code 2. Build might be incomplete.
10:51:53 Build Failed. 4 errors, 0 warnings. (took 2s.692ms)
This looks a lot like the error reported in this thread. I really need to use ADC. What's the best fix? Download an earlier version of STM32CubeIDE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-22 12:17 AM
You can just comment out those two lines. There is no clock mux to configure, so the ADC will work.
