1
\$\begingroup\$

I want to establish an SPI communication between a Raspberry Pi and an Alchitry Cu. I found this code that implements an SPI slave interface, from the outside it looks like this

module spi_slave(
    input clk,
    input rst,
    input ss,
    input mosi,
    output miso,
    input sck,
    output done,
    input [7:0] din,
    output [7:0] dout
  );

Can I route ss, miso, mosi and sck to any GPIO ports? Or are there special dedicated ports for this?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Why do you think some special pins are necessary? \$\endgroup\$ Jun 24, 2022 at 6:10

2 Answers 2

2
\$\begingroup\$

That's totally fine, as long as the requirements for the SPI is within the spec of the IOs (what it certainly is), you can use just any pin on your FPGA. Usually FPGA only have dedicated SPI interfaces to connect an external flash to load the image on startup.

\$\endgroup\$
1
\$\begingroup\$

SPI is just a piece of writing that tells you which pins to turn on and off in which order. It's not a special kind of pin.

The reason that some microcontrollers have special SPI pins, is that they have a special SPI circuit that turns the pins on and off in SPI order, and the SPI circuit is connected to the SPI pins. The reason there's a special SPI circuit is so that while the SPI data transfer is happening, the microcontroller's code can do other things instead of having to twiddle SPI pins on and off in the right order. This reason is only relevant to microcontrollers, not FPGAs.

It's possible that some company could make an FPGA with a special SPI circuit, so that you could save on logic resources by not having to make your own, and that could be connected to special SPI pins. I'm not aware of any that do - SPI is so simple that it probably wouldn't be useful. There are FPGAs out there with e.g. special PCIe circuitry and pins.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.