Read FPGA Flash on XEM7310

Hi everyone,
having a look at the Sample flashloader in the FrontPanel distribution I think I figured out how the flashloader.bit configuration file can be used to write something into the FPGA flash.
I’d like to know if there’s any example of how the FPGA flash could also be read (by the PC, not by the FPGA itself), or if the WireIns in the flashloader.bit FW can also be configured to read data from the flash.
Something like:

xem->SetWireInValue(0x00, j, 0xffff);	// Send starting address
xem->SetWireInValue(0x01, (MAX_TRANSFER_SIZE/FLASH_PAGE_SIZE)-1, 0xffff);		// Send the number of pages to read
xem->UpdateWireIns();							// Update Wire Ins
xem->UpdateTriggerOuts();						// Makes sure that there are no pending triggers back
xem->ActivateTriggerIn(0x40, 4);				// Trigger the beginning of the sector read routine
xem->ReadFromPipeOut(0x80, MAX_TRANSFER_SIZE, buf);

To give a bit of context, I want to write onto the system flash the FPGA configuration file, so that the device is configured automatically at start up and then I want to be able to write some data for the FW to use onto the FPGA flash. However, while I’m developing all of this I’d like to be able to check if and what I write on the FPGA flash, just to be sure what I’m doing makes sense before I try to use the data on the FPGA flash directly in the final FPGA FW.
Thanks in advance,
Filippo

1 Like

What version of FrontPanel are you using? In 5.2.7 we added a readout capability to our flashloader sample: Tool: FlashLoader - Opal Kelly Documentation Portal

We also have the C++ source code in the Samples folder too.

Additionally, system flash can be read by the FrontPanel API: FrontPanel API: okCFrontPanel Class Reference

If you want the easy way, you can actually just load a POR configuration bitfile within FrontPanel: Flash Programming Tool - Opal Kelly Documentation Portal

This should be all you need, but feel free to ask any questions if something is unclear!

Dear Hayden,
thanks for the quick reply!
I’m in fact using version 5.1.0, I should probably upgrade the library.
Next week I’ll check what amount of effort will be required to adapt the SW and FW to the latest FrontPanel version.
All the best