OpenCores

Project maintainers

Details

Name: spi_master
Created: Nov 13, 2024
Updated: Nov 14, 2024
SVN Updated: Nov 14, 2024
SVN: Browse
Latest version: download (might take a bit to start...)
Statistics: View
Bugs: 0 reported / 0 solved
Star0you like it: star it!

Other project properties

Category:Communication controller
Language:VHDL
Development status:Beta
Additional info:
WishBone compliant: No
WishBone version: n/a
License: LGPL

SPI Master

This module implements SPI master protocol, supporting:

  • CPOL Configuration
  • CPHA Configuration
  • Slave Select Polarity (active Low or High)
  • 2-Byte Delay Interval (0 to 7 SPI Clock Cycles)
  • Byte Number Configuration
  • Daisy-Chain (Slaves MUST support this feature)

Usage

The Ready signal indicates no operation is on going and the SPI Master is waiting operation. The Busy signal indicates operation is on going. Reset input can be trigger at any time to reset the SPI Master to the IDLE state.

  1. Set all necessary inputs
    • Byte Number (number of byte required to write/read)
    • Byte Delay (number of SPI SCLK Clock Cycles between 2 bytes to write/read)
    • Slave Select (set to '1' the Slave Select Line to enable)
    • Data to Write
  2. Asserts Start input. The Ready signal is de-asserted and the Busy signal is asserted.
  3. SPI Master re-asserts the Ready signal at the end of transmission (Master is ready for a new transmission)
  4. The read value is available when its validity signal is asserted

SPI Master Pin Description

Generics

NameDescription
input_clockModule Input Clock Frequency
spi_clockSPI Serial Clock Frequency
cpolSPI Clock Polarity ('0': SCLK IDLE at Low, '1': SCLK IDLE at High)
cphaSPI Clock Phase ('0': Data valid on Leading/First Edge of SCLK, '1': Data valid on Trailing/Second Edge of SCLK)
ss_polaritySPI Slave Select Polarity ('0': active Low, '1': active High)
ss_lengthNumber of Chip/Slave Select Lines
max_data_register_lengthMaximum SPI Data Register Length in bits

Ports

NameTypeDescription
i_clockInputModule Input Clock
i_resetInputReset ('0': No Reset, '1': Reset)
i_byte_numberInputSPI Byte Number during the Transmission
i_byte_delayInputSPI Delay between 2-Byte Transmission (0 to 7 SPI Clock Cycles)
i_slave_selectInputSPI Slave Selection ('0': Not Selected, '1': Selected)
i_startInputStart SPI Transmission ('0': No Start, '1': Start)
i_write_valueInputData to Write
o_read_valueOutputData Read from Slave
o_read_value_validOutputValidity of the Data Read ('0': Not Valid, '1': Valid)
o_readyOutputReady State of SPI Master ('0': Not Ready, '1': Ready)
o_busyOutputBusy State of SPI Master ('0': Not Busy, '1': Busy)
o_sclkOutputSPI Serial Clock
o_mosiOutputSPI Master Output Slave Input Data line
i_misoInputSPI Master Input Slave Output Data line
o_ssOutputSPI Slave Select Line (inverted ss_polarity: Not Selected, ss_polarity: Selected)