STM32H723 ADC Oversampling code generation bug
I am using STM32CubeIDE v1.13.2. When setting oversampling for ADC3 on STM32H723, the ratio value is incorrectly generated to exactly the number that is typed in the GUI:

hadc3.Init.Oversampling.Ratio = 32;
which is then on lines 725-735 in stm32h7xx_hal_adc.c written directly to the CFGR2 register:
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
);
however, for oversampling on ADC3, there is this mapping for the values:
000: 2x
001: 4x
010: 8x
011: 16x
100: 32x
101: 64x
110: 128x
111: 256x
By pure chance, this works correctly for values 2, 4 and 8 (as OVSR is offset by 2 in CFGR2). Higher values are of course broken.
The generated value should probably be from the ADC_HAL_EC_OVS_RATIO. As this is different from ADC1 and ADC2, I think that in Cube GUI, there should be a choice of predefined values and not free text as in ADC1 and ADC2.
Similar to this issue that was fixed: https://community.st.com/t5/stm32-mcus-embedded-software/stm32h745-adc-oversample-bug-in-hal/td-p/583308
