/* Set bus clk div. */
stcSysClkCfg.enHclkDiv = ClkSysclkDiv1; //200M, Max 200MHz CPU DMA Flash SRAM
stcSysClkCfg.enExclkDiv = ClkSysclkDiv2; //100M, Max 100MHz SDIO CAN
stcSysClkCfg.enPclk0Div = ClkSysclkDiv1; //200M, Max 200MHz Timer6
stcSysClkCfg.enPclk1Div = ClkSysclkDiv2; //100M, Max 100MHz USARTx TIM SPI
stcSysClkCfg.enPclk2Div = ClkSysclkDiv4; // 50M, Max 60MHz ADC
stcSysClkCfg.enPclk3Div = ClkSysclkDiv4; // 50M, Max 50MHz RTC I2C CMP WDT
stcSysClkCfg.enPclk4Div = ClkSysclkDiv2; //100M, Max 100MHz ADC TRNG
CLK_SysClkConfig(&stcSysClkCfg);
//ADC Clock set, PCLK2=50MHz PCLK4=100MHz
//Select PCLK2 as adc analog clok, PCLK4 as adc digital clock.
CLK_SetPeriClkSource(ClkPeriSrcPclk);
//ADCCLK=50MHz -> 200Ksps, Tsamp + Tconv_13clk = 250clk
//实际使用中,400sps用了4ms, 改成112+13速度恢复正常
uint8_t au8Adc1SaSampTime[1] = {112};
|