2024-04-13 09:25 AM
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):
ADC3 (divided by 6):
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
STM32CubeMX version: 6.11.0
Solved! Go to Solution.
2024-04-17 09:22 AM
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.
2024-04-13 10:36 AM
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.
2024-04-13 11:20 AM - edited 2024-04-13 11:38 AM
The ADCs have only one common clock/prescaler here :
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 . :)
2024-04-13 11:48 AM - edited 2024-04-13 11:57 AM
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.
2024-04-13 11:52 AM
@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:
and then for the CCR.PRESC value, it states that all the clocks are really common:
And ADC3 really has separate CCR register and different value can be written to the PRESC field:
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).
2024-04-13 11:59 AM
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.
2024-04-17 09:22 AM
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.