YosysHQ / nextpnr

nextpnr portable FPGA place and route tool
ISC License
1.31k stars 243 forks source link

Lattice ECP5 LFE5U-25F-6BG256C: Pin N9 is not working #818

Closed yodalee closed 3 years ago

yodalee commented 3 years ago

I am using the ECP5 develop board icesugar-pro and the FPGA is LFE5U-25F-6BG256C. I tried to connect to the SPI-FLASH on this board. According to the schematic, the FLASH_CLK is connected to port N9.

So I set the lpf file as below:

# top.lpf SPI-FLASH
LOCATE COMP "flash_cs"   SITE "N8";
LOCATE COMP "flash_mosi" SITE "T8";
LOCATE COMP "flash_miso" SITE "T7";
LOCATE COMP "flash_io2"  SITE "M7";
LOCATE COMP "flash_io3"  SITE "N7";
LOCATE COMP "flash_clk"  SITE "N9";

IOBUF PORT "flash_cs"   IO_TYPE=LVCMOS33 DRIVE=4;
IOBUF PORT "flash_clk"  IO_TYPE=LVCMOS33 DRIVE=4;
IOBUF PORT "flash_mosi" IO_TYPE=LVCMOS33 DRIVE=4;
IOBUF PORT "flash_miso" IO_TYPE=LVCMOS33 DRIVE=4;
IOBUF PORT "flash_io2"  IO_TYPE=LVCMOS33 DRIVE=4;
IOBUF PORT "flash_io3"  IO_TYPE=LVCMOS33 DRIVE=4;

and compile my project with following command:

nextpnr-ecp5 --25k --package CABGA256 --speed 6 --json top.json --textcfg top_out.config --lpf top.lpf

However I will get this error:

ERROR: IO pin 'flash_clk$tr_io' constrained to pin 'N9', which does not exist for package 'CABGA256'.
ERROR: Packing design failed.

I have check the prjtrellis database, which in the pio.json file of ECP5 LFE5U-25F do have no port N9.

Is this a setting error? or I just cannot use port N9 to communicate with the flash?

gatecat commented 3 years ago

You need to use USRMCLK for this pin, rather than using it as a regular IO.

yodalee commented 3 years ago

Thank for your reply. Here is what I understand after search the keyword of USRMCLK.

  1. Just remove the LOCATE COMP and IOBUF PORT definition of flash_clk in lpf file.
  2. In top.sv, I can access the clock with USRMCLK module
    
    module top (
    /* SPI-FLASH */
    output logic flash_cs,
    output logic flash_mosi,
    input flash_miso,
    input flash_io2,
    input flash_io3,
    );

logic tristate = 1'b0; USRMCLK u1(.USRMCLKI(flash_clk), .USRMCLKTS(tristate));


Now I can control the clk to flash by adjust the wire tristate.
Am I right?
gatecat commented 3 years ago

Yeah that should work

yodalee commented 3 years ago

Thanks, let me do some testing.