cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f411 spi4 low clock speed

mcufan
Associate III

Hello!

I have problem with spi4 clock speed. I want to drive a lcd tft display but spi clock is max 500Khz, baudrate prescaler set to SPI_BAUDRATEPRESCALER_2. Is very weird. Initial setup was made with CubeMX to 48Mbit/s. APB2 clock is set to 96Mhz. I tried with dma, and without hal but the speed remains the same

What is the cause of this very low spi clock output speed?

18 REPLIES 18

Read out and check/post the relevant RCC register's content.

Do you use any bootloader?

JW

mcufan
Associate III

I use stm32f411 disco board, the actual spi clk frequency measured with logic analyzer is exactly 500Khz

mcufan
Associate III

I use stm32f411 disco board. The spi sck pin freq. is 500khz measured with logic analyzer

S.Ma
Principal

You can even make spi by gpio at such speed to test the display functionality, then tune with spi hw peripherals

As you can see, although PLL is switched on in CR, PLLCFGR is at its default value; nonetheless your system clock is set to HSI in CFGR, and both APB dividers are set to 16 (maximum).

In other words, you don't run the SystemClock_Config() function as you've presented us above. Find out, how do you actually set the clocks.

JW

Something nominal in SystemInit() would be my guess

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mcufan
Associate III

Yes, you are right! I will try to setup the clock somehow.

Thank you!

mcufan
Associate III

Yess! done:) thank you for all. Clive, i set up in the SystemInit() the RCC_CFGR and RCC_PLLCFGR without calling the SystemClock_Config() and now spi is fast as hell:D

mcufan
Associate III

The only mistake was that when i created the code with CubeMX in the RCC setup the HSE selected value was BYPASS Clock Source and not Chrystal/Ceramic Resonator