2014-04-16 01:57 AM
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 / 4to 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 #stm32f42014-04-16 04:50 AM
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.2014-04-16 07:18 AM
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.