UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor w_d_anderson
Visitor
2,745 Views
Registered: ‎01-21-2013

Microblaze HWICAP IPROG Code

I am trying to use ICAP which will be controlled by the microblaze to select a complete bitstream to load from flash.  The code (snippet of main code  below) writes the IPROG command to the FIFO to  initialte the warm boot from a new Quad SPI Flash address.  When I do this I see our fpga  not_done LED go off for 15 secs. At this point it loads the wrong image from address 0x0 again.  I don't have the watchdog enabled so I am not sure what causes this timeout.    

 

  I have searched for examples but have not been able to find any with links that are still valid. Any working code snippets appreciated.  BTW, Our project uses a kintex 7.  I am assuming that ICAP can handle quad spi by default.  Also I assume that the bit stream that I load does not need any special ICAP instructions. Are these valid assumptions.

 

Thanks

Bill A

 

 

--snip--

 

#define HWICAP_BASEADDR         XPAR_AXI_HWICAP_0_BASEADDR

#define HWICAP_IDCODE_SIZE                  1

#define HWICAP_EXAMPLE_BITSTREAM_LENGTH     8

#define HWICAP_DEVICE_ID XPAR_AXI_HWICAP_0_DEVICE_ID

// Reusing IDCODE array and code to send IPROG

// From UG470 p. 126, Table 7-1

static

u32 ReadId[HWICAP_EXAMPLE_BITSTREAM_LENGTH] =

{

        0xFFFFFFFF,/* Dummy Word */

        0xAA995566,/* Sync Word*/

        0x20000000,/* Type 1 NO OP */

        0x30020001,/* Write WBSTAR cmd */

        0x00300000,/* Addr in SPI Flash of desired bitstream */

        0x30008001,/* Write CMD */

        0x0000000F,/* Write IPROG */

        0x20000000,/* Type 1 NO OP  */

};

 

 

int  main()

{

 

 

/* SOME GPIO CONTROL CODE DELETED */

 

/*

* Initialize the HwIcap driver.

*/

ConfigPtr = XHwIcap_LookupConfig(HWICAP_DEVICE_ID);

if (ConfigPtr == NULL) {

return XST_FAILURE;

}

 

 Status = XHwIcap_CfgInitialize(&HwIcap, ConfigPtr,ConfigPtr->BaseAddress);

if (Status == XST_SUCCESS) {  

    xil_printf("Call XHwIcap_CfgInitialize Success\n\r");

 }

   

 

            xil_printf("Attempting Warm Boot\n\r");

           

         //ret = fpga_iprog(0x0); // IPROG to third image which is in 24 bit address space

         ret = fpga_iprog(0x662000);// IPROG to third image which is in 24 bit address space

          //ret = fpga_iprog(0x1324000); // IPROG to third image which is in 25 bit address space

           

 

    xil_printf("\r\n\n fpga_iprog returned %d\n\n\r", ret);  // NEVER SHOULD MAKE IT BACK HERE ALIVE

   

return 0;

}

 

   

int fpga_iprog(u32 iprog_address)

    {

   

    u32 Status;

 

    ReadId[4] = iprog_address;

    Status = HwIcapIPROG(HWICAP_BASEADDR, iprog_address);

   

    if (Status != XST_SUCCESS) {

        return XST_FAILURE;

    }

   

   return XST_SUCCESS;

}

 

 

   

u32 HwIcapIPROG(u32 BaseAddress, u32 iprog_address)

    {

           

u32 Index;

           

u32 Retries;

           

u32 RegData;

           

 

             * Write command sequence to the FIFO

             */

           

for (Index = 0; Index < HWICAP_EXAMPLE_BITSTREAM_LENGTH; Index++) {

                    XHwIcap_WriteReg(BaseAddress, XHI_WF_OFFSET, ReadId[Index]);

            }

 

           

            /*

             * Start the transfer of the data from the FIFO to the ICAP device.

             */

            XHwIcap_WriteReg(BaseAddress, XHI_CR_OFFSET, XHI_CR_WRITE_MASK); 

//<<<< In debugger I get this far which I assumes should cause Warm start??

           

return XST_SUCCESS;

    }

0 Kudos
1 Reply
Contributor
Contributor
1,382 Views
Registered: ‎03-07-2014

Re: Microblaze HWICAP IPROG Code

Hi there

I went into exactly same problem as you - did you solve it ?

thanks
0 Kudos