Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Need Forum Guidance? Click here

Search our FPGA Knowledge Articles here.
19220 Discussions

Read/Write to HPS qspi flash from FPGA

Honored Contributor II

Hi Everybody, 


I am trying to write/read to/from HPS qspi flash from FPGA on the SoCKit board from Terasic. Is there any tutorial to do so?  


I didn't find any megafunction I can include as a flash controller. I know there is a hard-coded flash controller in the HPS but I can't use that from FPGA.  


This is what I have tried till now: 

1) I loaned the flash pins from HPS to FPGA. 

2) I went through datasheet for the flash and tried reading the status register and device ID. 


But I don't get any response from the flash. I tried to signaltap the IO pins that leave from FPGA but Quartus doesn't compile with these pins in signaltap and gives me an error.  


If someone could help me with this. 


Thank you, 

0 Kudos
4 Replies
Honored Contributor II



I used a logic analyser and checked the signals at the flash. It looks like the signals I'm writing out aren't reaching to the flash at all. 


Also, I cannot get to output anything on the pins I loan to FPGA from HPS. I'm trying to have four GPIO pins and make the LEDs of the HPS on SoCKit board blink. According to the schematic, GPIO 53:56 are connected to the LEDs. When I compile, Quartus is assigning the right pins to these LEDs. But I don't see the LEDs blink. 


In the peripherals mux table(second tab in the HPS megafunction in Qsys), there is 'mux_select_1', mux_select_2' and 'mux_select_3'. What is this? What does it do? Also, in the schematic it shows that multiple peripherals can be connected using the same pin?  


Honored Contributor II

you don't need to access HPS pins from FPGA. 

You need to connect the FPGA to the HPS with an Avalon bus bridge 

once you boot the HPS to a state where the flash is at know address and the bridge is active, you can use the avalon bus to access the Flash.
Honored Contributor II

Thanks for replying, Mosko9. Initially, we wanted FPGA to access data stored in the flash and didn't want to use the bridges to do this. So, wanted to know how to access HPS pins from FPGA. But now, we decided that we are going to read the data in the flash just once on power up. So, we'll be using HPS and bridges.  


But still, I would like to know how to access HPS pins from FPGA. If you know, could you please tell me how? 


Thank you, 



I am new developer for the Cyclone v SoC.

I want to read and write from the QSPI flash in my HPS baremetal application. I want to write a very simple data in words format.
write data 0xABCD, 0xCDEF, 0x1234
and then read it back.

I checked the following functions but they are not working for me.

I think i need to initialize the qspi and do the other initialization etc before using alt_qspi_write or alt_qspi_read.

Is there any one who developed a c program for QSPI of DE0-NANO-SOC?
is there any built application project doing the simple read and write on QSPI?