Skip to main content
heveskar
Senior
April 13, 2024
Solved

Code generation - ADC3 prescaler

  • April 13, 2024
  • 6 replies
  • 2731 views

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

    This topic has been closed for replies.
    Best answer by STTwo-32

    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

    6 replies

    STTwo-32
    ST Technical Moderator
    April 13, 2024

    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
    Super User
    April 13, 2024

    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 on " Best Answer ".
    STTwo-32
    ST Technical Moderator
    April 13, 2024

    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.
    STTwo-32
    STTwo-32Best answer
    ST Technical Moderator
    April 17, 2024

    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.