cancel
Showing results for 
Search instead for 
Did you mean: 

Bad SPI clock duration in stm32f746

ldpr
Associate
Posted on November 11, 2016 at 18:08

Hello. I have got stm32f746 and I make project with cubeMX.

I  want to use SPI4, SPI5, SPI6 as fullduplex master with 50Mb/s baudrate.

Then I try to

HAL_SPI_Transmit(&hspi4, pData, 1, 30000);

in while(1) cycle. Data has been sent, but the clock is very bad.(I put image in attachment. You can see there.)

As you see, duration is not 50%. When I set baudrate less then 50Mb/s, may be clock is good, but I need only 50Mb/s.

Is this my fault, or this is bug?
2 REPLIES 2
Posted on November 12, 2016 at 19:47

What's your LA's sampling frequency?

JW
Seb
ST Employee
Posted on December 10, 2016 at 19:55

Make sure the GPIO speed is setup to high frequency. You might check the signal quality with the optional pull-up mode.

The duty cycle of the clock signal probably depends on the SYSCLK and prescaler values (1/2, 1/4, 1/8, etc...)

50 MHz requires careful PCB lines and probably a serial resistor to avoid ringing. Also make sure to use if possible 4 wire mode and not 3 wire bi-directional. Definitely DMA will have to be used for good average data throughput. (6 channels, as you'll need a TX and RX channel for each SPI if they are used concurrently).

Good luck!