1 |
2 |
ldalmasso |
# SPI Master
|
2 |
|
|
|
3 |
|
|
This module implements SPI master protocol, supporting:
|
4 |
|
|
- CPOL Configuration
|
5 |
|
|
- CPHA Configuration
|
6 |
|
|
- Slave Select Polarity (active Low or High)
|
7 |
|
|
- 2-Byte Delay Interval (0 to 7 SPI Clock Cycles)
|
8 |
|
|
- Byte Number Configuration
|
9 |
|
|
- Daisy-Chain (Slaves MUST support this feature)
|
10 |
|
|
|
11 |
|
|

|
12 |
|
|
|
13 |
|
|
## Usage
|
14 |
|
|
|
15 |
|
|
The Ready signal indicates no operation is on going and the SPI Master is waiting operation. The Busy signal indicates operation is on going.
|
16 |
|
|
Reset input can be trigger at any time to reset the SPI Master to the IDLE state.
|
17 |
|
|
|
18 |
|
|
1. Set all necessary inputs
|
19 |
|
|
- Byte Number (number of byte required to write/read)
|
20 |
|
|
- Byte Delay (number of SPI SCLK Clock Cycles between 2 bytes to write/read)
|
21 |
|
|
- Slave Select (set to '1' the Slave Select Line to enable)
|
22 |
|
|
- Data to Write
|
23 |
|
|
2. Asserts Start input. The Ready signal is de-asserted and the Busy signal is asserted.
|
24 |
|
|
3. SPI Master re-asserts the Ready signal at the end of transmission (Master is ready for a new transmission)
|
25 |
|
|
4. The read value is available when its validity signal is asserted
|
26 |
|
|
|
27 |
|
|
## SPI Master Pin Description
|
28 |
|
|
|
29 |
|
|
### Generics
|
30 |
|
|
|
31 |
|
|
| Name | Description |
|
32 |
|
|
| ---- | ----------- |
|
33 |
|
|
| input_clock | Module Input Clock Frequency |
|
34 |
|
|
| spi_clock | SPI Serial Clock Frequency |
|
35 |
|
|
| cpol | SPI Clock Polarity ('0': SCLK IDLE at Low, '1': SCLK IDLE at High) |
|
36 |
|
|
| cpha | SPI Clock Phase ('0': Data valid on Leading/First Edge of SCLK, '1': Data valid on Trailing/Second Edge of SCLK) |
|
37 |
|
|
| ss_polarity | SPI Slave Select Polarity ('0': active Low, '1': active High) |
|
38 |
|
|
| ss_length | Number of Chip/Slave Select Lines |
|
39 |
|
|
| max_data_register_length | Maximum SPI Data Register Length in bits |
|
40 |
|
|
|
41 |
|
|
### Ports
|
42 |
|
|
|
43 |
|
|
| Name | Type | Description |
|
44 |
|
|
| ---- | ---- | ----------- |
|
45 |
|
|
| i_clock | Input | Module Input Clock |
|
46 |
|
|
| i_reset | Input | Reset ('0': No Reset, '1': Reset) |
|
47 |
|
|
| i_byte_number | Input | SPI Byte Number during the Transmission |
|
48 |
|
|
| i_byte_delay | Input | SPI Delay between 2-Byte Transmission (0 to 7 SPI Clock Cycles) |
|
49 |
|
|
| i_slave_select | Input | SPI Slave Selection ('0': Not Selected, '1': Selected) |
|
50 |
|
|
| i_start | Input | Start SPI Transmission ('0': No Start, '1': Start) |
|
51 |
|
|
| i_write_value | Input | Data to Write |
|
52 |
|
|
| o_read_value | Output | Data Read from Slave |
|
53 |
|
|
| o_read_value_valid | Output | Validity of the Data Read ('0': Not Valid, '1': Valid) |
|
54 |
|
|
| o_ready | Output | Ready State of SPI Master ('0': Not Ready, '1': Ready) |
|
55 |
|
|
| o_busy | Output | Busy State of SPI Master ('0': Not Busy, '1': Busy) |
|
56 |
|
|
| o_sclk | Output | SPI Serial Clock |
|
57 |
|
|
| o_mosi | Output | SPI Master Output Slave Input Data line |
|
58 |
|
|
| i_miso | Input | SPI Master Input Slave Output Data line |
|
59 |
|
|
| o_ss | Output | SPI Slave Select Line (inverted ss_polarity: Not Selected, ss_polarity: Selected) |
|