cancel
Showing results for 
Search instead for 
Did you mean: 

Code generation - ADC3 prescaler

heveskar
Senior

In the IDE GUI, when selecting asynchronous clock division for ADC3 on STM32H747XIH, the value generated in the code seems to be taken from ADC1, e.g.:

ADC1 (divided by 4):

heveskar_0-1713024808318.png

ADC3 (divided by 6):

heveskar_1-1713024842396.png

generated code (shortened):

/* ADC1 init function */
void MX_ADC1_Init(void)
{
...
  hadc1.Instance = ADC1;
  hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV4;
  hadc1.Init.Resolution = ADC_RESOLUTION_12B;
  hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
  hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
  hadc1.Init.LowPowerAutoWait = DISABLE;
  hadc1.Init.ContinuousConvMode = DISABLE;
  hadc1.Init.NbrOfConversion = 2;
  hadc1.Init.DiscontinuousConvMode = DISABLE;
  hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
  hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
  hadc1.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR;
  hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED;
  hadc1.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
  hadc1.Init.OversamplingMode = DISABLE;
  if (HAL_ADC_Init(&hadc1) != HAL_OK)
  {
    Error_Handler();
  }
...
}
/* ADC3 init function */
void MX_ADC3_Init(void)
{
...
  hadc3.Instance = ADC3;
  hadc3.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV4;
  hadc3.Init.Resolution = ADC_RESOLUTION_12B;
  hadc3.Init.ScanConvMode = ADC_SCAN_DISABLE;
  hadc3.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
  hadc3.Init.LowPowerAutoWait = DISABLE;
  hadc3.Init.ContinuousConvMode = DISABLE;
  hadc3.Init.NbrOfConversion = 1;
  hadc3.Init.DiscontinuousConvMode = DISABLE;
  hadc3.Init.ExternalTrigConv = ADC_SOFTWARE_START;
  hadc3.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
  hadc3.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR;
  hadc3.Init.Overrun = ADC_OVR_DATA_PRESERVED;
  hadc3.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
  hadc3.Init.OversamplingMode = DISABLE;
  if (HAL_ADC_Init(&hadc3) != HAL_OK)
  {
    Error_Handler();
  }
...
}

This is for project generated with STM32CubeMX v6.10.0. For project generated with STM32CubeMX v6.11.0, prescaler value for ADC3 is not even filled at all.

 

IDE version: 1.15.0

heveskar_2-1713025453593.png

 

STM32CubeMX version: 6.11.0

heveskar_3-1713025453592.png

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @heveskar 

The problem is a CubeMX generation that i've reported internally to the concerned team under internal ticket number 179287. The Figure that @AScha.3 shared is commun for each ADC interface (ADC1, ADC2 or ADC3) and not for all three of them.

Best Regards.

STTwo-32

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

6 REPLIES 6
STTwo-32
ST Employee

Hello @heveskar 

Think you for reporting this issue. I will escalate it intenally to the concerned team for correction.

Best Regards.

STTwo-32 

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.

AScha.3
Chief

The ADCs have only one common clock/prescaler here :

AScha3_0-1713032383645.png

So the setting can be only one for all ADC 1,2,3 .

(read in rm...)

btw

@STTwo-32 , i think " escalate it intenally " will not change this . 🙂

 

If you feel a post has answered your question, please click "Accept as Solution".

Hello @AScha.3 @heveskar 

Thank you for this information. I'm checking this internally for more details and i will be back to you as soon as possible.

Best Regards.

STTwo-32 

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.

@AScha.3 It doesn't seem so clear to me, if you look at the register description, RM first states that CCR is common for ADC1 and ADC2 and ADC3 is controlled separately:

heveskar_0-1713033349761.png

and then for the CCR.PRESC value, it states that all the clocks are really common:

heveskar_1-1713034025572.png

And ADC3 really has separate CCR register and different value can be written to the PRESC field:

heveskar_2-1713034143446.png

 

But if it really is common, the GUI configuration tool should force the same value for ADC3 and  ADC1 (this binding is already there for ADC1 and ADC2).

Hello @heveskar 

As i said before. I'm checking this internally and i will be back to you on monday with more clarifications.

Best Regards.

STTwo-32 

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.

STTwo-32
ST Employee

Hello @heveskar 

The problem is a CubeMX generation that i've reported internally to the concerned team under internal ticket number 179287. The Figure that @AScha.3 shared is commun for each ADC interface (ADC1, ADC2 or ADC3) and not for all three of them.

Best Regards.

STTwo-32

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.