Verilog Testbench For Spi Protocol
Verilog Testbench For Spi Protocol
Transfer Formats
Software can select any of four combinations of serial clock (SCK) phase and polarity using two
bits in the SPI control register (SPCR). The clock polarity is specified by the CPOL control bit,
which selects an active high or active low clock and has no significant effect on the transfer format.
The clock phase (CPHA) control bit selects one of two fundamentally different transfer formats.
The clock phase and polarity should be identical for the master SPI device and the communicating
slave device. In some cases, the phase and polarity are changed between transfers to allow a
master device to communicate with peripheral slaves having different requirements. The flexibility
of the SPI system on the DSPI allows direct interface to almost any existing synchronous serial
peripheral.
SC K C Y C L E# 1 2 3 4 5 6 7 8
SC K (C PO L=0)
SC K (C PO L=1)
M O SI M SB 6 5 4 3 2 1 LSB
M ISO M SB 6 5 4 3 2 1 LSB
SS
SC K C YC L E# 1 2 3 4 5 6 7 8
SC K (C PO L=1)
M O SI M SB 6 5 4 3 2 1 LSB
M ISO M SB 6 5 4 3 2 1 LSB
SS