spi-fpga icon indicating copy to clipboard operation
spi-fpga copied to clipboard

Maximum SCLK frequency on SPI SLAVE module

Open federicodesario97 opened this issue 2 years ago • 2 comments

Hi, firstly your code is very clear and i'm learning a lot from this, so thanks!

Then I was reading in another issue that with a CLK frequency that is at least twice the SCLK frequency the code works fine.

I was trying to use a CLK at 12 MHz and a SCLK at 4 MHz and i found some problem with the MISO of the SPI SLAVE module. Pratically the first 1 sended on the MISO remains too much on it and is sampled two times.

Screenshot 2023-08-09 172400

I'm using a simplified testbench that i can attach here.

SPI_SLAVE_tb.txt

There is something that I can do to fix this problem?

federicodesario97 avatar Aug 09 '23 15:08 federicodesario97

Another problem that can be seen in the snapshot is that when I send the next code, the MOSI switch correctly but the MISO is sending the previous code. In the shift register infact there is the old code. Am I doing something wrong in the testbench?

federicodesario97 avatar Aug 09 '23 20:08 federicodesario97

From the readme, SCLK must be <= CLK/10: image

With a 12MHz input clock, the maximum SCLK you can safely define is 12MHz/10 = 1.2MHz. If you need the 4MHz SCLK then you'll need a faster input clock

(I literally just found this project and I'm not familiar with the code, just referencing the documentation)

SamOrlan avatar Jun 25 '24 00:06 SamOrlan