Jump to content
  • 0

Are these the steps to program flash memory on Cmod A7-35?


trossin

Question

What can I say, I'm new to Vivado and searching the web for how to program the flash only came up with how to do it in 2018 which did not apply or how to mess with MicroBlaze issues.  I just have a little toy project which uses the MMCM, some counters and a UART I wrote to flash the LEDs.  I don't want to trash my board so I figured it would be better to ask the seasoned veterans before pushing the program button.  The bit file I created works fine.  I just want to make sure I know how to burn it into the serial flash device so I can create projects that power up without a laptop attached.  Below are the steps that I came up with for Vivado 2023.2.  Please let me know what I should be doing differently.  Thanks.

To burn design into serial flash once a bit file has been created:

  Make an mcs file by selecting Tools/Generate Memory Config File

  • My board has the SPI flash part with a-SPI71 500 MX25 L3233F printed on it.  Lots of lenses to see this!
            (32Mbit Marcronix device)
  • Click Memory Part and select the flash memory part (mx25l3273f-spi-x1_x2_x4 by using the Search feature [mx25l32 should be enough]).  The mx25l3273f is similar to 3233 which is also a 32Mbit Marcronix device but no Hold feature on SIO3.
  • Select a destination (in your project folder like blah.runs/impl_1/Blah.mcs).
  • I left the Interface as SPIx1.  It seems that the flash device supports SPIx4 but I'm afraid.  Will SPIx4 work?
  • Click the Load bitstream files check box and add the bitstream for your project blah.runs/impl_1/blah.bit
  • Click Overwrite and maybe Checksum.
  • Press OK

Open Hardware Manager, plug board into USB port then Open target then click Auto connect

  • Right click on device (xc7a35t_0) and select Add Configuration Memory Device ...
  • Select the flash memory part (mx25l3273f-spi-x1_x2_x4 by using the Search feature [mx25l32 should be enough])
  •     Macronix
  •     MX25L3233FZBI-08G/Q
  •     mx25l3233f (alias of mx25l3273f [also 32Mbit Marcronix device but no Hold feature on SIO3)
  • Don't program it now as in the future, there will be no need to add this device to the project and the programming will be done by selecting the flash memory device that was just added.

Once the device has been added, to program it, scroll down and right click on it (mx25l3273f-spi-x1_x2_x4) and select Program Configuration device (it needs a .bin or .mcs file).

  • Select the mcs file that was generated from the bit file above.
  • Click Ok to program the flash.

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Well.  That did work (when I changed from MCS to BIN as MCS caused a crash for me) but it took 8 seconds to load the FPGA after power up.  I did some searching and stumbled upon some secrets and hints and put them together to get things going in milliseconds instead of seconds.

The secret is to add these lines to your constraints file before synthesizing the design (I include the steps needed to find these settings):

    set_property BITSTREAM.GENERAL.COMPRESS TRUE [current_design]
    set_property BITSTREAM.CONFIG.CONFIGRATE 33 [current_design]
    set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]

Here is the recipe that worked for me on a project named SerialPort to write flash memory and get the FPGA loaded quickly at power up:

  Make an bin file by selecting Tools/Generate Memory Config File

  • My board has the SPI flash part with a-SPI71 500 MX25 L3233F printed on it (32Mbit Marcronix device)
  • Select BIN format
  • Click Memory Part and select the flash memory part (mx25l3273f-spi-x1_x2_x4 by using the Search feature [mx25l32 should be enough]).  The mx25l3273f is similar to 3233 which is also a 32Mbit Marcronix device but no Hold feature on SIO3.
  • Select a destination next to Filename: (in your project folder like SerialPort.runs/impl_1/SerialPort.mcs).
  • Change the Interface to SPIx4.  This requires the following in your constraint file before you built the design:

    set_property BITSTREAM.GENERAL.COMPRESS TRUE [current_design]

    set_property BITSTREAM.CONFIG.CONFIGRATE 33 [current_design]

    set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]

  • Click the Load bitstream files check box and add the bitstream for your project SerialPort.runs/impl_1/SerialPort.bit
  • Click Overwrite.
  • Press OK

Open Hardware Manager, plug board into USB port then Open target then Auto connect

  • Right click on device (xc7a35t_0) and select Add Configuration Memory Device ...
  • Select the flash memory part (mx25l3273f-spi-x1_x2_x4 by using the Search feature [mx25l32 should be enough])
  •     Macronix | MX25L3233FZBI-08G/Q | mx25l3233f (alias of mx25l3273f [also 32Mbit Marcronix device but no Hold feature on SIO3])
  • Don't program it now as from now on there will be no need to add this device to the project and the programming will be done by selecting the flash memory device that was just added.
  • Once the device has been added, to program it, right click on it (mx25l3273f-spi-x1_x2_x4) and select Program Configuration device (it needs a .bin or .mcs file).
  • Select the bin file that was generated from the bit file above.
  • Click Ok to program the flash.
  • When done, unplug the board from the USB port and plug it back in again and it should load your design.  

The secret to finding the magic BITSTREAM settings:

  • Click Open Implemented Design (if you don't, you can't select additional settings later on).
  • Once opened Right click on Generate Bitstream and select Bitstream Settings
  • Click on Configure additional bitstream settings (near the top)
  •     General:
  •         Enable Bitstream Compression  TRUE
  •     Configuration:
  •          Configuration Rate (MHz) Change to 33
  •          Scroll down and set Bus width under SPI Configuration to 4
  •     Click OK
  • Click OK
  • Close the Implemented Design and save the settings to a new file, copy and paste the BISTREAM settings to your configuration file and remove the new file from the project.
  • Now that there are new constraints, the whole process needs to be repeated to get the settings into the bitmap file so that they can be transferred to the bin file  Now it boots instantly instead of taking 8 seconds!  I have no idea if the Configuration Rate can be made faster or not but seems good enough at 33MHz.
Link to comment
Share on other sites

  • 0

Hi @trossin,

The steps you listed are correct.

For reference, now that you know three bitstream configuration lines to put in the constraints file, you can now just preemptively put those into future project constraint files without ever having to open the Implemented design.

If you ever end up needing to store a Microblaze/other processor project that uses Vitis on flash, I will likely end up pointing you to this thread:

Regardless, thank you for posting the steps you found. It also serves as a reminder to Digilent that we need to have a more generalized programming guide that also covers storing a project in flash rather than just creating a bitstream and then loading a project like we do on our two existing guides (link1, link2) which are available in the Tutorials section of the Cmod A7 Resource Center.

Thanks,
JColvin

Link to comment
Share on other sites

  • 0

Hi @trossin,

Thanks for taking the time to post that summary - very interesting. I had not known about the compression and speed options that can go in the constraints file. I have been doing something similar but with the CMOD-S7 and with a pure RTL design flow in Vivado 2023.1. The CMOD-S7 has the same 3233 Macronix part and requires converting to .bin, which I also had to figure out for myself.

I ran across a weird behavior and wonder if you or anyone noticed anything similar: that is in order to write the flash chip, I always have to first rebuild the design. Then I can right click on the device in hardware manager and select "Add Configuration Memory Device". If I open a previously built, saved design and try to use that to program the flash chip on a different CMOD-S7, when I right click on the device, "Add Configuration Memory Device" is always grayed out. Although I can download the saved bitstream to the device, I can't figure out how to write to the flash chip unless I first rebuild the design.

Cheers,

-JC

Link to comment
Share on other sites

  • 0

Hi @QuailJohn,

If you already have the bitstream initially generated, then yes you will have to rebuild the design so that Vivado can also generate the .bin file (after you check the appropriate box in project settings.

However, you should not need to rebuild the project just to add the flash chip via the "Add Configuration Memory Device", genereated bitstream or no. All you should need to do is connect whatever FPGA, target the device in the Hardware Manager, and then add the appropriate flash chip. If this didn't work, then the Vivado Lab Edition which only lets users load .bin files and bitstreams (and do some debugging with the ILA) wouldn't work at all.

Here, I connected a Cmod A7 with a project that had a bitstream (but no bin file generated, checked to be generated, nor extra lines surrounding such in the .xdc) built for an Nexys A7 100T and am still able to see and add the Configuration Memory Device:

image.png

Similarly, you can also just open a brand new Vivado project with whatever FPGA selected and no design at all, and get the same result

Thanks,
JColvin

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...