Target Category: Linux Raspberry Pi
The SPI Config block lets you choose the hardware settings for the SPI Read for Linux and SPI Write for Linux blocks. Before you configure the SPI, it is a good idea to first insert a corresponding target configuration block in your diagram and specify the CPU device.
Bit Rate=Clk Src/SPIDiv: Displays the bit rate.
CLK Polarity: Clocks the polarity. You have two choices: Send on rise/Latch on fall and Send on fall/Latch on rise.
Clk Src: Selects the clock for the serial port unit. Raspberry Pi runs at Advanced Peripheral Bus (APB) clock speed, which is equivalent to core clock speed (250 MHz). The supported clock speed ranges from 32 kHz to 125 MHz.
Mux Pin Assignment: Sets the external pins used to carry the SPI signals.
Network Mode: Indicates that the mode is set to Master. Slave mode does not work on Raspberry Pi.
SPIDiv: Specifies the divider for the system clock to set the SPI clock rate. The clock speed can be divided by any number from 1 to 3900 for the desired speed.
Sync Data: Synchronizes the data on the clock edge or ½ cycle before clock edge.
Sync Data (CPHA) |
CLK Polarity (CPOL ) |
SPI Mode |
on clock edge (0) |
Send on rise/Latch on fall (0) |
MODE 0 |
½ cycle before clock edge (1) |
Send on rise/Latch on fall (0) |
MODE 1 |
on clock edge (0) |
Send on fall/Latch on rise (1) |
MODE 2 |
½ cycle before clock edge (1) |
Send on fall/Latch on rise (1) |
MODE 3 |
Transmitted Bits: Sets the number of bits transmitted per transaction.
Unit: Specifies the unit number. Raspberry Pi has one SPI interface, referred to as SPI0. It also has a mini SPI interface, referred to as SPI1.