Electronic – In a Lattice MachXO2, how can I use the EFB SPI slave and configuration SSPI (multiplexing)

fpgalatticespi

I am using a Lattice MachXO2 FPGA eval board and Lattice Diamond 3.4.0.80 on Linux.

I want to use the configuration SSPI to update the FPGA configuration. During user mode, I want to use the same SPI pins for the EFB SPI (except for SN, which enables SSPI configuration).

Basically, I am trying to follow TN1204 Fig. 12 (see below) & TN1205 Fig. 9-12 & 9-14.

I generated an SPI EFB module, added the SPI ports to my top level, and assigned the hardened SPI pins to these ports. So far, Diamond is happy.

However, when I set the sysCONFIG SLAVE_SPI_PORT to ENABLE, Diamond's PAR tells me

1103805 WARNING – Current SYS_CONFIG setting prohibits pin "44" to be used as user IO. This preference has been disabled.

and it moves my SPI port to a different pin. This even happens if I only set MASTER_SPI_PORT to EFB_USER (see SYSCONFIG help).

Is there a way to multiplex the EFB SPI with the configuration SSPI, even if just temporary (e.g. during initialization during/after PROGRAMN asserted)? Am I missing some settings in Diamond?


TN1204 Fig. 9:

TN1204 Fig.12

Best Answer

I'm guessing that the problem is that the SN-pin is dedicated to the hard macro (EFB) for the Configuration mode. For User mode you should use another pin, see the definition of spi_scsn, that can be placed on whichever user I/O you want. The pin on the generated EFB-block is probably the chip select for the User mode. Placing it on the SN pin will cause a no-fit since this pin is reserves for the ufm_sn (or just SN) function. The SN pin will be automatically used when enabling SLAVE_SPI_PORT.

Hope that helps, if you found another solution please let me know as we are doing more or less the same thing soon.

Response from Lattice on pinning:
1. Spi_clk --> Assign to "MCLK/CCLK" pin on Bank-2. 2. Spi_miso --> Assign to "SO/SPISO" pin on Bank-2. 3. Spi_mosi --> Assign to "SI/SISPI" pin on Bank-2. 4. Spi_scsn --> Assign to any GPIO (No bank preference). 5. Ufm_sn --> Assign to "SN" pin on Bank-2.

About EFB settings:
If you have instantiated "EFB" with SPI (either Master or Slave) enabled in your design then, the "SLAVE_SPI_PORT" attribute in the Diamond's "Global Preferences" automatically gets enabled after the Synthesis process. So, you need not have to set it exclusively, it will be taken care by the tool automatically.

Next is the IPExpress settings. In the IPExpress, along with enabling the " SPI" option, enable the "User Flash Memory" option as well. Then, in the "SPI" tab, select the SPI Mode as "Slave", this is user mode SPI selection option..