How to setup the SPI SCK frequency to 16M, or some other frequency higher than 9M?
I am using STM32F103ZET6 to work with TI ADS8688 via SPI interface.
Based on the sample program in STM32F10x_StdPeriph_Lib_V3.5.0 library, currently the basic function is OK, with SCK @ 9M.
Here is my program screenshot about clock and SPI configurations, (external crystal
@8M)
---------------------------------------------------------------------------------------------------
void RCC_Configuration(void)
{
/* PCLK2 = HCLK/2 */
RCC_PCLK2Config(RCC_HCLK_Div2);
/* Enable SPI Master peripheral clocks --------------------------------------------------*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_SPI1, ENABLE);
}
/* SPI_MASTER configuration ------------------------------------------------*/
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI1, &SPI_InitStructure);
----------------------------------------------------------------------------------------------------------------
However, with different sample rate of ADS8688, I need to change the SCK to higher frequency, such as 16M. (Since the highest working frequency of ADS8688 is 17M).
Although I can change the SPI_BaudRatePrescaler to 2, so as to get 18M SCK. It will exceed the max working frequency of ADS8688).
So would you please help to point out, how I can set the clock, or SPI configurations, to obtain higher SCK, that will closer to 17M frequency.
Thanks in advance.
