Hello,
I am currently trying to get my SPI bus to operate at the datasheet listed 48MHz. My understanding is all I need to do is set up my initial clocks with the 96MHz PLL and then in the platform_devices.h just set my divider to the minimum (2). Unfortunately I can't seem to get my spi clock to run faster than 8MHz, which leads me to believe that the clock set up is not changing from 16MHz.
Here is the relevant code:
main.c - system_init()
...
cm_sys_clk_init(sysclk_PLL96);
cm_apb_set_clock_divider(apb_div1);
cm_ahb_set_clock_divider(ahb_div1);
cm_lp_clk_init();
...
cm_sys_clk_set(sysclk_PLL96);
...
plateform_devices.h
#ifdef CONFIG_SPI_DISPLAY
SPI_SLAVE_DEVICE(SPI1, DISPLAY_SPI, HW_GPIO_PORT_4, HW_GPIO_PIN_5, HW_SPI_WORD_9BIT,
HW_SPI_POL_LOW, HW_SPI_PHA_MODE_0, HW_SPI_FREQ_DIV_2, -1);
#endif
Any ideas?
Hi SamsonLeoMarch,
Could you please follow the steps below and let me know if you are able set the SPI bus to operate at 48MHz?
cm_sys_clk_init(sysclk_XTAL16M); // instead of sysclk_PLL96
cm_apb_set_clock_divider(apb_div1);
cm_ahb_set_clock_divider(ahb_div1);
cm_lp_clk_init();
/* Set system clock */
cm_sys_clk_set(sysclk_PLL96);
REG_SET_FIELD(CRG_PER, CLK_PER_REG, SPI_CLK_SEL, clk_per_reg_local, 1);// select SPI clock - DIV1 - system clock
SPI_SLAVE_DEVICE(SPI1, TEST_SPI, HW_GPIO_PORT_4, HW_GPIO_PIN_0, HW_SPI_WORD_8BIT,
HW_SPI_POL_LOW, HW_SPI_PHA_MODE_0, HW_SPI_FREQ_DIV_2, 0); // SPI at 48 MHz
#define dg_configUSE_HW_SPI (1)
#define dg_configSPI_ADAPTER (1)
Please try these steps and let me know if your issue has not been fixed.
Thanks, PM_Dialog
Thank you! Changing the MUX for the SPI clock was what did it. I had set up the PLL properly, but was still using the DivN clock instead of the sys_clock for the SPI.
For anyone in the future looking to solve this problem, this is what did it:
Hi SamsonLeoMarch,
Glad that you figured your issue out. Thanks for your indication and for accepting my answer.
Thanks, PM_Dialog