Using Multiple SPI and I2C Devices in a Design

Related article: NanoBoard SPI Communications - Interface Wiring

When interfacing to a single common-bus SPI (or I2C) device from an FPGA design, access to the device is straightforward – simply place the specific port component representing the interface to that device, and wire to it (typically from an interface controller in the design).

For example, if you want to access and use the SPI Flash memory on a NanoBoard NB2 or 3000-series NanoBoard, you would place the SERIALFMEMORY port component, from the relevant port-plugin integrated library for that particular board.

If your design is to communicate with multiple common-bus SPI (or I2C) devices, you can not simply place the corresponding specific port component for each device. To do so would result in multiple port components with the same pin names being used (e.g. SDA, SCL for I2C devices). This duplication of names will lead to errors when the design is processed for the target FPGA device.

The solution is to place, and wire to, a single SPI- or I2C-based port component. To use a specific port component can make the design hard to read, especially if the device represented graphically by that component is not even targeted by that design! To avoid this situation, generic SPI- and I2C-based port components are provided. Table 1 summarizes these components, which can be placed from the port-plugin integrated library for the type of NanoBoard you are using.
 

Your design may need to communicate with multiple common-bus SPI- and/or I2C-based resources, but remember that communications can only be carried out with one such resource of each type at a time. Access to more than one device, in turn, would be achieved through the embedded software for your design.

 

Table 1. Generic port-plugin components.
Component Symbol
Component Name
Description

SPI_BUS

Place this component to include a generic interface to the motherboard's common SPI bus within your FPGA design.

I2C_BUS

Place this component to include a generic interface to the motherboard's common I2C bus within your FPGA design.


3000-series NanoBoards also provide independent SPI resources – resources to which the User FPGA has dedicated (and independent) SPI communications links. Each of these resources has an associated port component, which interfaces to a unique set of physical device pins for that interface. Again, the associated graphic of the component reflects the slave SPI resource being communicated with. As each of these resources has a dedicated SPI bus, you may use any or all of these port components in the same design. A separate SPI Controller peripheral component would be placed in the design for each resource being used. In addition, you can interface to one or more common-bus SPI resources in the same design, as described above.