-
Notifications
You must be signed in to change notification settings - Fork 3
SPI One Pager #65
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
base: main
Are you sure you want to change the base?
SPI One Pager #65
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||
| # SPI - Module Brief (v1.0) | ||||||
|
|
||||||
| **Owner:** Nicholas McNeill | ||||||
| **RTL:** rtl/io/spi.sv | ||||||
|
|
||||||
| Purpose & Role: | ||||||
| The Serial Peripheral Interface (SPI) is a high speed, 4-wire, full-duplex communication protocol used for short distance data exchange between microcontrollers and peripherals. It uses a shared clock signal to synchronize data transfer. | ||||||
|
|
||||||
| Parameters (Registers) & Signals: | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please split parameters and input/output signals into separate tables to prevent confusion |
||||||
| Resides on the AXI-Lite Interconnect bus, in a Master (CPU) to Slave (SPI) configuration. All register reads and writes are performed through AXI-Lite signals. | ||||||
|
|
||||||
| | Name | Addr. | Default Val | Purpose | | ||||||
| | --- | --- | --- | --- | | ||||||
| | SPDR (Data register) | 000 | R/W 0x00 | Holds the byte to be transmitted or the byte just recieved | | ||||||
| | SPCR (Control Register) | 001 | R/W 0x00 | Enables SPI< selects master/slave mode, and sets clock polarity | | ||||||
| | SPSR (Status Register) | 010 | R/W 0x02 | Indicates transfer completion, write collisions, and mode faults. | | ||||||
| | SPBR (Baud Rate Register) | 011 | R/W 0x02 | Sets the clock frequency divider for the SCK signal. | | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| | CSCR (Chip Select Register) | 100 | R/w 0xFF | **Manages multiple Slave Select lines for peripheral addressing.** | | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why the description here is highlighted, might just be a formatting error |
||||||
| | Signal | Dir | Size | Description | | ||||||
| | clk_o | Out | 1b | Serial Clock generated by the Master to synchronize data. | | ||||||
| | Mosi_o | Out | 1b | Master Output, Slave Input; carries data from SoC to peripheral. | | ||||||
| | Miso_i | In | 1b | Master Input, Slave Output; carries data from peripheral to SoC. | | ||||||
| | Ss_n_o | Out | 4b | Slave Select (Active Low) to enable specific external devices. | | ||||||
| | Axi_lite_\* | M<->S | Var | Standard AXI-Lite bus signals (AWADDR, WDATA, RDATA, etc.) for register access. | | ||||||
| | Irq_o | Out | 1b | Interrupt request sent to CPU upon transfer completion or error. | | ||||||
|
|
||||||
| Configurations: | ||||||
| Clock Modes: Supports all four SPI modes defined by CPOL and CPHA to ensure compatibility with various peripheral timing requirements.Master/Slave: Primarily configured as a Master in SoC environments, but can be toggled to Slave mode via the SPCR.Baud Rate: The sclk_o frequency is derived by dividing the system clock by the value in SPBR.AXI-Lite valid/ready signals are required for internal register stability before data is shifted out to the physical SPI lines. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible, define CPOL and CPHA for members to understand how they affect SPI's behavior. |
||||||
|
|
||||||
| Behavior & Timing: | ||||||
| Timing is strictly governed by clk_o. Data is shifted out and shifted in simultaneously during every clock cycle. To reduce CPU overhead, 16-byte Rx/Tx FIFOs are utilized. Interrupts are triggered when Rx reaches a threshold or the Tx is empty. | ||||||
|
|
||||||
| Errors & Dependencies: | ||||||
| Erros are managed by irq_o. Several errors can occur; write collision, mode fault, dependencies, or GPIO. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please give one-line descriptions of what each of these errors is and how it happens (Also typo on "erros" in description) |
||||||
|
|
||||||
| Dependencies are the CPU/software driver for hardware interaction in correcting errors or resetting status flags. Reset and known clock signals are also dependent for UART to function properly. If utilizing modem for loopback/flow control with no dedicated pins, then GPIO pins are necessary. | ||||||
|
|
||||||
| Performance Targets: | ||||||
| Up to 50 Mhz. 0% Frequency drift. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far, just need a little more descriptiveness and formatting fixes. Please add heading syntax (##) to each section for visuals and feel free to use bullet points (-) or (*) to organize info