cancel
Showing results for 
Search instead for 
Did you mean: 

SPI maximum SCLK speed

jono-tree
Associate II
Posted on April 16, 2014 at 10:57

I'm currently trying to interface an STM32F4 (discovery) with a telemetry unit (RFM42B if anyones interested) using SPI.

The minimum clock time high and time low given in the telemetry devices datasheet for SPI are 40ns each, making a minimum period of 80ns, and max frequency of 12.5MHz.

So in my SPI configuration I used 

SPI_InitStruct.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8; // SPI frequency is APB2 frequency / 4

to get an SCLK freq of 105MHz, under the RFM's max sclk freq.

I did get this from my SCLK pin when I checked with the oscilloscope, BUT, the waveform is fairly distorted. It's distorted once it reaches the RFM's pin, but also at the pin of the discovery board too.

I tried prescaling the SCLK by another factor of two, which reduced the distortion but it still looks a bit dodgy. 

Perhaps I'm trying to use unsensible SCLK freq values, but I'm just wondering if anyone can suggest where I may otherwise be going wrong? It seems a bit odd that they'd define prescale values for SPI SCLK at which the STM32 cannot produce a good enough waveform.

#sclk #spi #discovery #stm32f4
2 REPLIES 2
chen
Associate II
Posted on April 16, 2014 at 13:50

Hi

2 things :

1.  The slew rate setting for the port bit

    gpio_c.GPIO_Speed = GPIO_Speed_50MHz;

For your pupose must be one of these :

  GPIO_Speed_25MHz  = 0x01, /*!< Medium speed */

  GPIO_Speed_50MHz  = 0x02, /*!< Fast speed */

  GPIO_Speed_100MHz = 0x03  /*!< High speed on 30 pF (80 MHz Output max speed on 15 pF) */

2. I am sure I do not have to tell you to calibrate the scope probe.

Posted on April 16, 2014 at 16:18

I tried prescaling the SCLK by another factor of two, which reduced the distortion but it still looks a bit dodgy.

 

What's the bandwidth of your scope and probe? I'd bet you're using a probe in 1X mode. Use a 10X probe.

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