master, a695d293
- Compiler.
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release)
- Platform and board.
STM32H753 REV V
- Nature of the problem.
STM32_ADC12_CLOCK which was computed as 3.125 MHz. Measured ADC conversion time at max SMPR (should be 810.5 ADC clock cycles) by triggering ADC12 and TIM4 using TIM3 and then reading TIM4->CNT in the interrupt. The resulting latency was MUCH lower than could be achieved by an ADC running at 3.125 MHz. Back-computing the frequency based on the interrupt latency, the MINIMUM possible ADC frequency came out as ~14 MHz.
I am still trying to understand this. These are the numbers from my setup:
Code: Select all
STM32_PLLCLKIN = 25000000
STM32_PLL1_DIVM_VALUE = 25
STM32_PLL1_REF_CK = (STM32_PLLCLKIN / STM32_PLL1_DIVM_VALUE)
STM32_PLL1_DIVN_VALUE = 400
STM32_PLL1_VCO_CK = (STM32_PLL1_REF_CK * STM32_PLL1_DIVN_VALUE)
STM32_PLL1_DIVP_VALUE = 2
STM32_PLL1_P_CK = (STM32_PLL1_VCO_CK / STM32_PLL1_DIVP_VALUE)
STM32_SYS_CK = STM32_PLL1_P_CK
STM32_SYS_D1CPRE_CK = (STM32_SYS_CK / 1)
STM32_HCLK = (STM32_SYS_D1CPRE_CK / 4)
STM32_ADC_SCLK = (STM32_HCLK / 2)
STM32_ADC12_CLOCK = (STM32_ADC_SCLK / 4 / 2)
I have determined from a thorough reading of the reference manual that, at the very least, STM32_ADC_SCLK should be (STM32_SYS_CK / 2) instead of (STM32_HCLK / 2)
- Failure mode.
BOOST bits are set incorrectly at the very least.