cancel
Showing results for 
Search instead for 
Did you mean: 

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

elb-lab
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

8 REPLIES 8
TDK
Guru

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".

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.

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.

elb-lab
Associate II

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
Associate II
 
elb-lab
Associate II
 

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.

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?