Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spi clock input pin #3

Open
mattvenn opened this issue Nov 3, 2020 · 5 comments
Open

spi clock input pin #3

mattvenn opened this issue Nov 3, 2020 · 5 comments

Comments

@mattvenn
Copy link
Owner

mattvenn commented Nov 3, 2020

The ecp5 spi clock pin is used for configuration (reading SPI flash or being an SPI peripheral) and is detailed in TN1260 pdf.
The SPI clock pin is on ball N9, but this can't be used in the constraints file.

After configuration it can work as an output using the USRMCLK primitive:

wire tristate = 1'b0;
USRMCLK u1 (.USRMCLKI(spi_clk), .USRMCLKTS(tristate));

It seems it can't be used as an input. It might work with the FPGA setup as SPI peripheral: sysconfig = 001.

The board sets sysconfig to 010 as SPI controller. This is done with RN1.

workaround is to use the shared connection between raspberry pi gpio6 (pin 31) and fpga ball t6. Bridge pi gpio6 to spiclk (gpio11). Make sure that gpio6 is set to an input on the pi:

gpio -g mode 6 in

@mattvenn
Copy link
Owner Author

mattvenn commented Nov 4, 2020

see test-spi-clk-in branch for an example.

@mattvenn
Copy link
Owner Author

mattvenn commented Nov 5, 2020

tying raspi pins together with a direct short doesn't seem to work. but soldering a header on, and using a jumper does. This was tested on 2 boards.
so before fixing this on the board need to understand what is happening.

hstarmans pushed a commit to hstarmans/basic-ecp5-pcb that referenced this issue Jul 17, 2021
be able to program bitstream faster.
Done

* used IS25LP016D-JBLE as flash, but
 it has problems with enabling QE for QSPI.
Relace with the model used on icebreaker
This is already done, comment should be removed

* ecp5 SPI clock pin can't be used as an input
 so have to [add a bodge wire](mattvenn#3)
for SPI peripheral comms with Pi.
See the test-spi-clk-in branch for a workaround.
Worked around by connecting this pin to a second FPGA pin

* connected I2C pins are just GPIOs. I have found the Pi's I2C hardware unusable, so always use the slower bitbanged version.
Connected I2C pins to official pins.
Removed pull resistors as this is not needed
@francis2tm
Copy link

Hello, nice work with this repo.
I think I didn't quite understand your comments. If the ECP5 is configured in Slave SPI mode (thus, the configuration SPI clock pin should be an input) it is not possible to reuse all the SPI pins after the ECP5 is configured, that is, in user mode?
I'm designing a board where the ECP5 is connected to a microcontroller via SPI and the microcontroller is the master. The objective is to use the same SPI bus to:

  1. Microcontroller configures ECP5, ECP5 in Slave SPI mode
  2. Data transfers ECP5 <-> Microcontroller when ECP5 is in user mode.

From your experience, is it possible?

@mattvenn
Copy link
Owner Author

mattvenn commented Jun 8, 2022

I'm sorry I can't remember. Reading my comment I think the limitation is the pin can't be used as an input. I would advise you to test before doing a board layout.

@francis2tm
Copy link

thanks for the reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants