Skip to main content
MWest.2
Visitor II
August 17, 2021
Solved

STM32CubeIDE generates reproducible erroneous code for the STM32L412 Nucleo-64 using ADC1 or ADC2 after a recent update to 1.7.0

  • August 17, 2021
  • 5 replies
  • 1869 views

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.

This topic has been closed for replies.
Best answer by Amel NASRI

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

5 replies

MMart.20
Visitor II
August 19, 2021

Hello,

I am getting the same error after the latest update. I hope they push a fix soon.

MMart.20
Visitor II
August 30, 2021

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.0693W00000DlbdGQAR.png

Amel NASRI
Amel NASRIBest answer
ST Technical Moderator
September 2, 2021

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 "Best Answer" on the reply which solved your issue or answered your question.
CKugl.1
Senior
October 21, 2021

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?

MMart.20
Visitor II
October 22, 2021

You can just comment out those two lines. There is no clock mux to configure, so the ADC will work.