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

Add an SPI controller for reading #2

Closed
nmigen-issue-migration opened this issue Dec 23, 2019 · 2 comments
Closed

Add an SPI controller for reading #2

nmigen-issue-migration opened this issue Dec 23, 2019 · 2 comments

Comments

@nmigen-issue-migration
Copy link

Issue by HarryHo90sHK
Monday Dec 23, 2019 at 08:38 GMT
Originally opened as m-labs/nmigen-stdio#2


On this pull request, I propose an SPI flash controller module exclusively for reading data or registers out of a flash device. Currently, it has:

  • _SPIFlashReaderBase: a base class from which can be inherited to create a new controller module, such as one that reads the ID of the flash device by issuing the opcode 0x9F (or 0x9E)
  • SPIFlashSlowReader: a module for normal reads from the device, meaning no dummy cycles of waiting is needed right after sending the address bytes to the device, while the read frequency is often capped.
  • SPIFlashFastReader: a module for "fast reads", meaning a faster frequency than normal reads while a number of dummy cycles of waiting is needed right after sending the address bytes.

Note that only the SlowReader but not the FastReader has been successfully tested on the ECP5 evaluation board.

In order to use the clock signal clk as the SPI clock for this module design, ECP5 requires the user NOT to request for SPI clock that corresponds to the on-chip oscillator (MCLK) but to instantiate a USRMCLK Instance. Therefore, to use this module and bulid the configuration bitstream on nextpnr without errors (see this comment), the user must avoid requesting for the normal clock pin from Ball U3 by some means. One way is to use my proposed modification of nmigen-boards.

I look forward to seeing further comments, thanks.


HarryHo90sHK included the following code: https://github.com/m-labs/nmigen-stdio/pull/2/commits

@nmigen-issue-migration
Copy link
Author

Comment by HarryHo90sHK
Friday Jan 03, 2020 at 06:58 GMT


I factored out the USRMCLK primitive and fixed most of the styling on f87fa5e1e9614a30ee7b08ebb8e43e253854558e.

Currently test_spiflash.py only asserts whether the data read by the SPI readers match the memory content of a simulated SPI flash device; looking at the VCD is not necessary.

I haven't changed the nMigen version number lest it hasn't been finalised.

@whitequark
Copy link
Member

The PR is outdated and the author is no longer working on it.

@whitequark whitequark closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants