+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Member level 5
    Points: 1,421, Level: 8

    Join Date
    Sep 2014
    Location
    Prague
    Posts
    90
    Helped
    2 / 2
    Points
    1,421
    Level
    8

    Configuring ICE40 FPGA directly from ESP32 uC rather than using dedicated flash IC

    Hello. I am working on project based around Espressif ESP32 uC and Lattice ICE40 FPGA. FPGA will do some heavy lifting and handle several buses, while providing uC with preprocessed data over SPI.

    So if i do some changes in uC firmware, i may as well need to update FPGA bitstream on flash and uC firmware on another flash. I wonder if i can completely ditch the flash storing FPGA configuration and configure the FPGA from uC firmware instead. So i will compile the FPGA bitstream as binary blob into the uC firmware and stream it to FPGA during uC boot.

    I think it can reduce the BOM and make OTA firmware updates easier...

    Is this common/reccomended way of doing things? Are there any downsides?

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 5
    Points: 24,823, Level: 38
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,753
    Helped
    1055 / 1055
    Points
    24,823
    Level
    38

    Re: Configuring ICE40 FPGA directly from ESP32 uC rather than using dedicated flash I

    im not familiar with your uc. Can you read data from program flash? If so, then you can use it to store your FPGA bitstream.



    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 4
    Points: 7,791, Level: 21
    Achievements:
    7 years registered

    Join Date
    Jul 2010
    Location
    Sweden
    Posts
    1,049
    Helped
    398 / 398
    Points
    7,791
    Level
    21

    Re: Configuring ICE40 FPGA directly from ESP32 uC rather than using dedicated flash I

    Yes, it is common to do the configuration from a microprocessor.
    In your case, it seems to be the best solution.

    Use the "Slave SPI" mode.

    http://www.latticesemi.com/-/media/L...ument_id=46502



    •   AltAdvertisement

        
       

  4. #4
    Member level 5
    Points: 1,421, Level: 8

    Join Date
    Sep 2014
    Location
    Prague
    Posts
    90
    Helped
    2 / 2
    Points
    1,421
    Level
    8

    Re: Configuring ICE40 FPGA directly from ESP32 uC rather than using dedicated flash I

    Quote Originally Posted by std_match View Post
    Use the "Slave SPI" mode.
    Yes. I was hoping that uC in Slave SPI mode can pretend it's a flash IC to make things easy

    BTW does the FPGA need the SPI to be online after the configuration was done? Can i reuse the SPI flash pins of FPGA in my HDL code? I already need to use slave SPI for communication between configured FPGA and uC, so it would be cool if i can configure the FPGA and then use the same Slave SPI bus to do my business after boot/configuration sequence.



  5. #5
    Advanced Member level 5
    Points: 24,823, Level: 38
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,753
    Helped
    1055 / 1055
    Points
    24,823
    Level
    38

    Re: Configuring ICE40 FPGA directly from ESP32 uC rather than using dedicated flash I

    Yes, you can use the SPI ports for your own nefarious needs after configuration. Just pay attention to what's attached to those ports.



  6. #6
    Super Moderator
    Points: 264,115, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    46,151
    Helped
    14034 / 14034
    Points
    264,115
    Level
    100

    Re: Configuring ICE40 FPGA directly from ESP32 uC rather than using dedicated flash I

    Yes. I was hoping that uC in Slave SPI mode can pretend it's a flash IC to make things easy.
    "Slave SPI mode" in the configuration manual refers to operating the uC as SPI master and ICE40 as slave which is most likely the easier way.



  7. #7
    Super Moderator
    Points: 32,106, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,426
    Helped
    1742 / 1742
    Points
    32,106
    Level
    43

    Re: Configuring ICE40 FPGA directly from ESP32 uC rather than using dedicated flash I

    Quote Originally Posted by harvie View Post
    Yes. I was hoping that uC in Slave SPI mode can pretend it's a flash IC to make things easy
    You should read the documentation. The FPGA is not the master when programming in SPI from a uC. The uC is the SPI master and programs the FPGA.

    BTW does the FPGA need the SPI to be online after the configuration was done? Can i reuse the SPI flash pins of FPGA in my HDL code? I already need to use slave SPI for communication between configured FPGA and uC, so it would be cool if i can configure the FPGA and then use the same Slave SPI bus to do my business after boot/configuration sequence.
    I doubt there is any way to access the SPI configuration pins in the FPGA fabric, but I can't check the documentation as I can't seem to download anything from Lattice's website right now all the PDF downloads stall after a MB or so downloaded.



    •   AltAdvertisement

        
       

  8. #8
    Member level 5
    Points: 1,421, Level: 8

    Join Date
    Sep 2014
    Location
    Prague
    Posts
    90
    Helped
    2 / 2
    Points
    1,421
    Level
    8

    Re: Configuring ICE40 FPGA directly from ESP32 uC rather than using dedicated flash I

    Quote Originally Posted by ads-ee View Post
    I doubt there is any way to access the SPI configuration pins in the FPGA fabric
    I've just checked the datasheet and the pinout section states the SPI configuration pins are shared and can be reused as GPIO after configuration. So that's perfect for me... (i don't need to occupy two SPI buses of uC, can use single one for both)

    https://cz.mouser.com/datasheet/2/22...et-1149905.pdf



--[[ ]]--