2023-11-13 03:59 PM
Set ADC3 with 16 oversampling
But what I got is doubled. ADC3[1] is 5V and ADC3[4] is 3.3V
-------------------------------------
In "void MX_ADC3_Init(void)",
hadc3.Init.Oversampling.Ratio = 16;
hadc3.Init.Oversampling.RightBitShift = ADC_RIGHTBITSHIFT_4;
Went through the HAL_ADC_Init(), found
#if defined(ADC_VER_V5_V90)
if (hadc->Instance == ADC3)
{
/* Configuration of Oversampler: */
/* - Oversampling Ratio */
/* - Right bit shift */
/* - Triggered mode */
/* - Oversampling mode (continued/resumed) */
MODIFY_REG(hadc->Instance->CFGR2,
ADC_CFGR2_OVSR |
ADC_CFGR2_OVSS |
ADC_CFGR2_TROVS |
ADC_CFGR2_ROVSM,
ADC_CFGR2_ROVSE |
hadc->Init.Oversampling.Ratio |
hadc->Init.Oversampling.RightBitShift |
hadc->Init.Oversampling.TriggeredMode |
hadc->Init.Oversampling.OversamplingStopReset
);
}
else
{
When "Ratio" is 16, it's directly written into "CFGR2" with other settings. This is not right. It's actually making a 32x oversampling.
Change the setting as "0x0C", I got what I want.
2023-11-13 11:33 PM - edited 2023-11-13 11:35 PM
Hello @QLiu.6 ,
Thank you for bringing this issue to our attention.
I reported this bug internally.
Internal ticket number: 163742 (This is an internal tracking number and is not accessible or usable by customers).
Thank you.
Kaouthar
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.