SPI Write operation is used to send
data from the controller device to the peripheral device. This operation is
performed over the SPI bus , where the controller device controls the clock (SCLK)
and sends data to the peripheral. SPI Write is commonly used to configure
peripherals, send control commands, or transfer data.
SPI Write Steps
- Drive CS
low. This enables the internal shift register.
- Shift 24 bits of data into the
device in a MSB first fashion, MSB bit . Data must be stable during the rising
edge of SCLK.
- The MSB bit must be a '0' indicating it is a write operation.
- 16 bits of status is sent out on
SDO. The first 2 bits are 2’b11 (indicating it to be a status segment). The next
6 bits are the Bit 5 to 0 of the Fault status register. The last 8 bits are all
0s.
- After the last bit of data is
transferred, drive SCLK low if there is no more data to be transferred.
- The previous content of the
register is sent out on SDO as the data byte is driven on SDI.
- De-assert CS
(drive it high) to end the write cycle.