Skip to main content
elb-lab
Associate II
Jul 20, 2021 1:51 PM UTC
Solved

STM32CubeMX 6.3.0. Bug: ADC.C file copying error for STM32L4 Microcontroller

I just updated STM32CubeMX from version 6.2.0 to 6.3.0 which configured the adc.c file by inserting the line of code highlighted in the figure. The compiler gives an error recognizing that the 'ADCClockSelection' parameter does not exist. How can this error be corrected?

This topic has been closed for replies.
Khouloud OTHMAN
Khouloud OTHMANBest answer
Associate
Aug 4, 2021 10:46 AM UTC

Hi @elb-lab​ ,

I want to come back to this topic to confirm that this issue was detected with STM32L412 MCUs and it is reported internally to be fixed. I'll keep you posted with the updates.

Sorry for any inconvenience that this may cause.

Meanwhile you can try with the previous STM32CubeMX version 6.2.1, it seems that no compilation error was detected.

Even though this reply doesn’t directly solve the issue, I’m marking it as Best, since it will help clarify the current situation for other customers with the same question. I will post an update here once the issue has been fixed.

Khouloud.

8 replies

TDK
Jul 20, 2021 2:46 PM UTC

Your image didn't come through. Pasting images doesn't work, you need to click on the "image" icon, upload, then select it.

Or just show the file and point out the line with a comment.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Khouloud OTHMAN
Associate
Jul 23, 2021 2:44 PM UTC

Hello @elb-lab​ ,

Thanks for your feedback.

Actually, I can't reproduce the issue from my side and the selected ADC clock source is correctly generated by STM32CubeMX.

Could you please attach your .ioc file for further check.

Your feedback will be very helpful to track faster the root cause of this issue.

Thanks in advance,

Khouloud.

Khouloud OTHMAN
Khouloud OTHMANBest answer
Associate
Aug 4, 2021 10:46 AM UTC

Hi @elb-lab​ ,

I want to come back to this topic to confirm that this issue was detected with STM32L412 MCUs and it is reported internally to be fixed. I'll keep you posted with the updates.

Sorry for any inconvenience that this may cause.

Meanwhile you can try with the previous STM32CubeMX version 6.2.1, it seems that no compilation error was detected.

Even though this reply doesn’t directly solve the issue, I’m marking it as Best, since it will help clarify the current situation for other customers with the same question. I will post an update here once the issue has been fixed.

Khouloud.

CKugl.1
Senior
Oct 21, 2021 7:23 PM UTC

I'm having a similar problem with NUCLEO-L412KB and STM32CubeIDE, Version: 1.7.0, Build: 10852_20210715_0634 (UTC). Can I use STM32CubeMX version 6.2.1 to repair STM32CubeIDE? Or, should I use an earlier version of STM32CubeIDE?

elb-lab
elb-labAuthor
Associate II
Aug 4, 2021 3:39 PM UTC

I am attaching the .ioc file and the ADC.c file written by the STM32CubeMX.It should be clarified that I use the STM32L422KBT6 microcontroller. I saw that the CubeMX writes in the ADC.c file, at line 110, the following code:

PeriphClkInit.AdcClockSelection = ADCCLockSelection;

However, in the PeriphClkInit structure, the AdcClockSelection entry is not defined. 0693W00000D1XhWQAV.png0693W00000D1XhCQAV.png0693W00000D1Xh7QAF.pngIn fact, I checked in the file "stm32l4xx_hal_rcc_ex.h" where the entry "AdcClockSelection" is defined, it is not declared as STM32L412xx and STM32L422xx do not need to select the clock source. I am attaching the figures of my code.

Thank you

elb-lab
elb-labAuthor
Associate II
Aug 4, 2021 3:41 PM UTC
elb-lab
elb-labAuthor
Associate II
Aug 4, 2021 3:41 PM UTC
Khouloud OTHMAN
Associate
Aug 6, 2021 12:09 PM UTC

Hello @elb-lab​ ,

Thanks for your feedback and for the detailed report.

You're absolutely right. In fact, referring to STM32L4 Reference manual, the ADCs clock which is derived (selected by software) from one of the following

sources:

  • system clock (SYSCLK)
  • PLLSAI1 VCO (PLLADC1CLK) (not available on STM3L41xxx and STM32L42xxx devices)

0693W00000D1jsKQAR.png 

Thus, as you've mentioned, STM32L412xx and STM32L422xx do not need to select the clock source.

However the HAL_ADC_MspInit function is wrongly generated using the latest 6.3.0 version of STM32CubeMX.

As I've already mentioned, no problem was detected with the previous STM32CubeMx version 6.2.1. I assume that the HAL_ADC_MspInit function used to be correctly generated:

void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
{
 GPIO_InitTypeDef GPIO_InitStruct = {0};
 if(hadc->Instance==ADC1)
 {
 /* USER CODE BEGIN ADC1_MspInit 0 */
 
 /* USER CODE END ADC1_MspInit 0 */
 /* Peripheral clock enable */
 __HAL_RCC_ADC_CLK_ENABLE();
 
 __HAL_RCC_GPIOA_CLK_ENABLE();
 /**ADC1 GPIO Configuration
 PA0-CK_IN ------> ADC1_IN5
 PA1 ------> ADC1_IN6
 */
 GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;
 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG_ADC_CONTROL;
 GPIO_InitStruct.Pull = GPIO_NOPULL;
 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
 /* USER CODE BEGIN ADC1_MspInit 1 */
 
 /* USER CODE END ADC1_MspInit 1 */
 }
 
}

With this being said, this issue has been submitted to our development team to plan a fix. I'll surely keep you posted with the updates.

Thanks for your contribution.

Khouloud.