Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20638 Discussions

How to access QSPI Flash from HPS f2h interface

Jiayi_H_Intel
Employee
917 Views

Hi expert, 

I am using Stratix 10 SoC board. And my FPGA logic needs to access flash.

In my setup, HPS boot from SD card not QSPI Flash. And QSPI locate at 0xff8d2000 in HPS's map.

I connect my bus to HPS's f2h interface and try to write data to address 0xff8d2000, but the data cannot be written into QSPI.

Is my operation correct? Does QSPI need additional setting up in this scenario?

 

Can you please help with that? Much thanks!

0 Kudos
15 Replies
aikeu
Employee
896 Views

Hi Jiayi_H_Intel,


When u-boot boot up, in u-boot type help. Check for a command which is bridge. Then select bridge enable and see any difference.


Thanks.

Regards,

Aik Eu



0 Kudos
Jiayi_H_Intel
Employee
885 Views

Hi Aik Eu,

 

I tied your suggestions, seems no difference. Can you please help?

Here are details of my design and test step:

I use jtag master to access hps's f2h interface:

Jiayi_H_Intel_0-1654768378017.png

Arm device tree is:

Jiayi_H_Intel_2-1654768719987.png

 

In arm uboot boot up terminal, I type "bridge enable", and then "boot" for default boot.

In system console:

set service_paths [get_service_paths master]
set master_service_path [lindex $service_paths 1]
set claim_path [claim_service master $master_service_path mylib]
master_write_32 $claim_path 0xff8d2000 0x1234

master_read_32 $claim_path 0xff8d2000 0x1

 

Read returns 0x0. So my write to flash is not successfully.

Can you please help with that?

 

0 Kudos
aikeu
Employee
874 Views

Hi Jiayi_H_Intel,


Can provide the base address of the IP involves in your qsys design?


Thanks.

Regards,

Aik Eu


0 Kudos
Jiayi_H_Intel
Employee
869 Views

Hi Aik Eu, here is my qsys design

Jiayi_H_Intel_0-1654830278591.png

 

0 Kudos
Jiayi_H_Intel
Employee
847 Views

Hi expert, any suggestions?

0 Kudos
aikeu
Employee
841 Views

Hi Jiayi_H_Intel,


Is is possible that you can sent me your design in email?

I not sure how big is the size.


Thanks.

Regards,

Aik Eu


0 Kudos
aikeu
Employee
813 Views

Hi Jiayi_H_Intel,


For Stratix10, I think you may not able to access the sdm_QSPI on the FPGA side since you are booting up from sd-card. I afraid the access to the sdm_QSPI will not be allowed. Some of the boot up configuration was written in the sdm_QSPI when booting up, so simply writing to the sdm_QSPI may overwrite the configuration data.


Anyway, Can try "sf probe" in U-boot and see. Do let me know what will show after that?


I think you were trying to write to to sdm_QSPI_register(0xFF8D2000), maybe can try to write to the sdm_QSPI_data_Address(0xFF900000 to 0xFF9FFFFF) instead.

Can check with the Stratix10 HPS Address Map, link as below:

https://www.intel.com/content/www/us/en/programmable/hps/stratix-10/hps.html#dap1505405910812.html


After sf probe, try the below read/write example link below using sf command in U-boot:

https://blog.krybot.com/a?ID=01550-3cc5b429-9aaf-45e5-b934-b73d31966d36


Thanks.

Regards,

Aik Eu


0 Kudos
Jiayi_H_Intel
Employee
799 Views

Hi Aik Eu,

After "sf probe", it shows:

SF: Detected mt25qu02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB

0 Kudos
aikeu
Employee
792 Views

Hi Jiayi_H_Intel,


Is the sf write/read working? Can verify try that also and let me know.

Do perform sf probe first before sf write/read.


Thanks.

Regards,

Aik Eu


0 Kudos
aikeu
Employee
779 Views

Hi Jiayi_H_Intel,


Got any follow up from the previous comment?


Thanks.

Regards,

Aik Eu


0 Kudos
aikeu
Employee
772 Views

Hi Jiayi_H_Intel,


Regarding the sf cmd in order to write to QSPI flash, need to take note that you will required to perform a sf erase first before you can write into it.

example:

sf erase 0 0x200000  

// Erase 2MB from QSPI offset 0x0

// Note: If erase size is less than QSPI Flash page size, u-boot reports erase error


Before running any sf cmd, you will need to execute sf probe first.

As for sf write/read cmd:

sf write will be writting the content of the memory location specified in the cmd into QSPI flash.

sf read will be reading the data from QSPI flash into the memory location specified in the cmd.


You can use U-boot md cmd to check the changes in the memory location that you specified when performing sf write/read cmd.

U-Boot read command can be used to see what is programmed in to QSPI memory.


Thanks.

Regards,

Aik Eu


0 Kudos
aikeu
Employee
766 Views

Example of working as below:

Temp21.PNG

0 Kudos
Jiayi_H_Intel
Employee
747 Views

Hi Aik Eu,

 

Thanks for your reply. So in conclusion, the only way to access qspi flash is through sf cmd in boot stage. The function of sf cmd is to move data between flash and memory. And it is not allowed to access flash from FPGA side by F2H port. Is that correct?

And much thanks for your help.

 

 

0 Kudos
aikeu
Employee
741 Views

Hi Jiayi_H_Intel,


The sdm QSPI is on the FPGA side. The sf cmd we tried is one of the method to read/write from HPS side. Another method will be considering the Mailbox Client IP in your design in order to do that.

Refer to the document below for Mailbox Client IP:

https://www.intel.com/content/www/us/en/docs/programmable/683290/21-3-20-1-0/mailbox-client-fpga-ip-user-guide.html


Normally is not advisable to write on the sdm QSPI as some of the FPGA configuration data is written there while booting up from sd card for the case of Stratix 10 devices.

Anyway if you are confident that you will not overwrite those data, then probably can consider doing so for your system operation.


Thanks.

Regards,

Aik Eu


0 Kudos
aikeu
Employee
726 Views

Hi Jiayi_H_Intel,


I will close this thread if no further question. Do consider open a new thread if there is new follow up question.


Thanks.

Regards,

Aik Eu


0 Kudos
Reply