How to read/write user data to QUAD SPI in C programming?

Recommended Posts


Currently, we are working on MicroZed board. I would like to know a way to read and write user data to QUAD SPI in c programming during run time. Does anyone know any example that I can refer to? We already programmed the BOOT.bin into it for auto loading during power cycle, but we also need a way to read/write user data on the fly without going thru the SDK.


Link to post
Share on other sites


I found a couple of links that talk about reading/writing to the Quad SPI Flash during run time. Here is a link about Read/Write AXI Quad API IP with Vivado HLS. Here is another link but with the basys 3 which is not a zynq styled fpga, but it might help with the process. Here on page 335 of the Zynq-7000 All Programmable SoC Technical Reference Manual pdf manual talks about the process. 



Link to post
Share on other sites
  • 3 weeks later...

Is it possible to read/write user data to quad spi in .xml format and how to do it? Currently, I access it using fix number of bytes for each user data. We found that this method is not future proof as sequence may change. So, we are thinking of keeping the data in .xml format and only accessing it from there.

Link to post
Share on other sites


I think you may be asking the wrong question.  The answer to "Is it possible ..." is yes, it is possible.  It's not a very interesting or revealing answer, though.

I guess some of it depends upon how you wish to access your flash device.  My personal preference, as encoded in the wishbone quad-spi flash controller I built some time ago, is to access the flash device just like memory.  That works great for reading.  Writing usually requires two steps though: erasing (setting all bits in a sector to ones) and programming (setting some bits to zeros).  I handle the first by disabling a write protect in the controller, then writing to a register on the controller that commands an erase, and then waiting for an interrupt to tell me that the erase is complete.  I handle the second by disabling the write protect and then writing the data I want straight to the memory addresses of interest on the device.  Both can be commanded/controlled from either an on-board CPU, such as the ZipCPU, or from a controller on the host using an off-board wishbone-to-uart interface.

But, back to your question, I personally do not know of any decoders from .xml format to the raw binary format that dealing with a Quad SPI flash requires.



Link to post
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