SPI using spidev

The Rapsberry Pi has a SPI interface on its GPIO header. With the spidev driver the FPGA can be used by using only 4 wires (MOSI, MISO, CLCK, and CS). This driver is designed to work with a variety of boards, as long as they expose the spidev device.

HUB-75 sinking input PCB - front

Configuration

The configuration of the FPGA consist of the definition of the pins where MOSI, MISO, CLCK, and CS are connected to. Below is the example used for the HUB75HAT.

"connection": {
    "connection_type": "spi",
        "mosi": "j5:14",
        "miso": "j5:12",
        "clk":  "j5:15",
        "cs_n": "j5:11"
}

HAL

Use the following connection string for spidev:

loadrt litexcnc connections="spidev:\dev\spidev0.0"

This will load spidev interface 0 with chip select 0. The available spidev devices can be listed with the code below.

ls /dev/spidev*.*