Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum SCLK frequency on SPI SLAVE module #11

Open
federicodesario97 opened this issue Aug 9, 2023 · 2 comments
Open

Maximum SCLK frequency on SPI SLAVE module #11

federicodesario97 opened this issue Aug 9, 2023 · 2 comments

Comments

@federicodesario97
Copy link

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
Copy link
Author

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?

@SamOrlan
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants