cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX ADC_Settings/Clock PreScaler setting does not show up in MX_ADCx_Init Code

GreenGuy
Lead

STM32CubeMX - STM32 Device Configuration Tool

Version: 6.10.0-RC9

Build: 20231120-2037 (UTC)

 

GreenGuy_1-1712792431036.png

 Unless I cannot see the forest for the trees, the prescale setting is not there.

 

 /** Common config
  */
  hadc3.Instance = ADC3;
  hadc3.Init.Resolution = ADC_RESOLUTION_16B;
  hadc3.Init.ScanConvMode = ADC_SCAN_ENABLE;
  hadc3.Init.EOCSelection = ADC_EOC_SEQ_CONV;
  hadc3.Init.LowPowerAutoWait = DISABLE;
  hadc3.Init.ContinuousConvMode = DISABLE;
  hadc3.Init.NbrOfConversion = 3;
  hadc3.Init.DiscontinuousConvMode = DISABLE;
  hadc3.Init.ExternalTrigConv = ADC_SOFTWARE_START;
  hadc3.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
  hadc3.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR;
  hadc3.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;
  hadc3.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
  hadc3.Init.OversamplingMode = DISABLE;
  if (HAL_ADC_Init(&hadc3) != HAL_OK)
  {
    Error_Handler();
  }

  /** Configure Regular Channel
  */
  sConfig.Channel = ADC_CHANNEL_TEMPSENSOR;
  sConfig.Rank = ADC_REGULAR_RANK_1;
  sConfig.SamplingTime = ADC_SAMPLETIME_810CYCLES_5;
  sConfig.SingleDiff = ADC_SINGLE_ENDED;
  sConfig.OffsetNumber = ADC_OFFSET_NONE;
  sConfig.Offset = 0;
  sConfig.OffsetSignedSaturation = DISABLE;
  if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }

  /** Configure Regular Channel
  */
  sConfig.Channel = ADC_CHANNEL_VBAT;
  sConfig.Rank = ADC_REGULAR_RANK_2;
  if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }

  /** Configure Regular Channel
  */
  sConfig.Channel = ADC_CHANNEL_VREFINT;
  sConfig.Rank = ADC_REGULAR_RANK_3;
  if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }

 

 

So I added to the user section like so:

 

static void MX_ADC3_Init(void)
{

  /* USER CODE BEGIN ADC3_Init 0 */

  /* USER CODE END ADC3_Init 0 */

  ADC_ChannelConfTypeDef sConfig = {0};

  /* USER CODE BEGIN ADC3_Init 1 */
  hadc3.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV2;
  /* USER CODE END ADC3_Init 1 */

 

Does it show up somewhere else?

Or is this a bug in the CubeMX code?

Or solved by the latest rev?

 

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Issue fixed in the latest version of CubeMx 6.12.0

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.

View solution in original post

4 REPLIES 4
SofLit
ST Employee

Hello,

You need to provide the MCU part number or at least attach the ioc file.

Why are you not using the latest version 6.11?

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.

STM32H743

I am in the middle of development and as a rule I never jump to a new revision of the tools unless I am specifically fixing something in the current project where the current tool is the problem.

 

 


I am in the middle of development and as a rule I never jump to a new revision of the tools unless I am specifically fixing something in the current project where the current tool is the problem.

 

I must agree with that.

Need to check and get back to you as soon as possible. 

Internal ticket 178907 not accessible by community users.

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.
SofLit
ST Employee

Issue fixed in the latest version of CubeMx 6.12.0

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.