cancel
Showing results for 
Search instead for 
Did you mean: 

Increase SPI Frequency on STM32F4 Disc

monta
Associate II
Posted on May 17, 2015 at 17:29

Hi there , I use the SPI3 unit on my STM32F4 Discovery board to control a TFT. I want the images to load faster and as a result I need to increase the SPI3 clock/frequency. Currently this line of code clocks the unit:

RCC->APB1ENR |= RCC_APB1Periph_SPI3;

Any idea how can I get to 1.5 or 2 MHz.

Thank you
5 REPLIES 5
Posted on May 17, 2015 at 17:49

Well that seems relatively slow.

Given the way the prescalers work you might have to play with the CPU and AHB/APB clocks to hit specific rates you want. You might have to run the CPU slower than maximal to get the integer divisions you need.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
monta
Associate II
Posted on May 17, 2015 at 18:11

Hi there, thank you for your quick reply. Actually what I want is faster not slower. As far as I know the STM32F4 Disc runs with 8 Mhz crystal. So is it the AHB or the AHP that can give me the right speed ? it's because the bitmaps are showing slowly on my 128*128 tft

Posted on May 17, 2015 at 18:57

The STM32F4-DISCO has an 8 MHz external source, and 16 MHz internal one, but those can feed to a PLL/VCO capable of running the CPU at 168 MHz, with the buses at fractions of that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
monta
Associate II
Posted on May 17, 2015 at 19:28

So what do you suggest sir ?

I need At least the tft to update with 10fps . How can colck it to be faster ? Thank you

Mark Edwards
Associate II
Posted on May 19, 2015 at 00:26

Which STM32F4? For STM32F429

RCC->APB1ENR |= RCC_APB1Periph_SPI3 Enables the clock to the SPI

Bits 3-5 (BR) in SPI_CR1 Set the divisor value of the clock.

According to the 429 datasheet SPI3 can communicate at up to 22.5 Mbit/s (SPI1, SPI4, SPI5, and SPI6 up to 45 Mbits/s) assuming you have overdrive on and so running it at 180MHz.

So APB1 running at 45MHz/32  = 1.41MHz (BR[2:0] = 100)  45MHz/16 = 2.8MHz (BR[2:0] = 011)