|
| 1 | +<img align="right" src="../psi_logo.png"> |
| 2 | + |
| 3 | +*** |
| 4 | +# psi_common_spi_master_cfg |
| 5 | + |
| 6 | +- VHDL source: [psi_common_spi_master_cfg.vhd](../../hdl/psi_common_spi_master_cfg.vhd) |
| 7 | +- Testbench: [psi_common_spi_master_cfg_tb.vhd](../../testbench/psi_common_spi_master_cfg_tb/psi_common_spi_master_cfg_tb.vhd) |
| 8 | + |
| 9 | +### Description |
| 10 | + |
| 11 | +**This component allows enlarging dynamically the bit width of the transfer via MaxTransWidth_g generic statement and TransWidth input.** |
| 12 | + |
| 13 | +The description here below is the same as *psi_common_spi_master* |
| 14 | + |
| 15 | +This entity implements a simple SPI master. All common SPI settings are |
| 16 | +settable to ensure the master can be configured for different |
| 17 | +applications. |
| 18 | + |
| 19 | +The clock and data phase is configurable according to the SPI standard |
| 20 | +terminology described in the picture below: |
| 21 | + |
| 22 | +<p align="center"><img src="ch10_1_fig23.png"> </p> |
| 23 | +<p align="center"> CPOL and CPHA meaning </p> |
| 24 | + |
| 25 | +For CPHA = 1, the sampling happens on the second edge (blue) and data is |
| 26 | +applied on the first edge (red). For CPHA = 0 it is the opposite way. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +### Generics |
| 31 | + |
| 32 | +Generics | Description |
| 33 | +--------------------|--------------------------------------------------- |
| 34 | +**ClockDivider\_g** | Ratio between *Clk* and the *SpiSck* frequency |
| 35 | +**MaxTransWidth\_g**| Maximum SPI Transfer width (bits per transfer) |
| 36 | +**CsHighCycles\_g** | Minimal number of *Cs\_n* high cycles between two transfers |
| 37 | +**SpiCPOL\_g** | SPI clock polarity (see figure above) |
| 38 | +**SpiCPHA\_g** | SPI sampling edge configuration (see figure above) |
| 39 | +**SlaveCnt\_g** | Number of slaves to support (number of *Cs\_n* lines) |
| 40 | +**LsbFirst\_g** | **False** = MSB first transmission, **True** = LSB first transmission |
| 41 | +**MosiIdleState\_g**| Idle state of the MOSI line |
| 42 | + |
| 43 | +### Interfaces |
| 44 | + |
| 45 | +Signal | Direction | Width | Description |
| 46 | +-----------------|-----------|-----------------|----------------- |
| 47 | + Clk | Input | 1 | Clock |
| 48 | + Rst | Input | 1 | Reset (active high) |
| 49 | + Start | Input | 1 | A high pulse on this line starts the transfer. Note that starting a transaction is only possible when *Busy* is low. |
| 50 | + Slave | Input | log2(SlaveCnt\_ g) | Slave number to access |
| 51 | + Busy | Output | 1 | High during a transaction |
| 52 | + Done | Output | 1 | Pulse that goes high for exactly one clock cycle after a transaction is done and *RdData* is valid |
| 53 | + WrData | Input | *MaxTransWidth\_g* | Data to send to slave. Sampled during *Start = '1'* |
| 54 | + TransWidth | Input | log2ceil(MaxTransWidth\_g) | indicate the actual vector length to forward/receive |
| 55 | + RdData | Output | *MaxTransWidth\_g* | Data received from slave. Must be sampled during *Done = '1'* or *Busy = '0'*. |
| 56 | + SpiSck | Output | 1 | SPI clock |
| 57 | + SpiMosi | Output | 1 | SPI master to slave data signal |
| 58 | + SpiMiso | Input | 1 | SPI slave to master data signal |
| 59 | + SpiCs\_n | Output | *SlaveCnt\_g* | SPI slave select signal (low active) |
| 60 | + |
| 61 | + |
| 62 | +<p align="center"><img src="ch10_1_fig24.png"> </p> |
| 63 | +<p align="center"> Parallel interface signal behavior </p> |
| 64 | + |
| 65 | +*** |
| 66 | +[Index](../psi_common_index.md) **|** Previous: [Interfaces > axilite slave ipif](./ch10_6_axilite_slave_ipif.md) **|** Next: [Miscellaneous > delay](../ch11_misc/ch11_1_delay.md) |
0 commit comments