Community
cancel
Showing results for 
Search instead for 
Did you mean: 
TFPGA
Beginner
384 Views

Write FPGA image into EPCQ32A using Nios 2

Hi I have a system with Nios 2 + epcq controller 2.

 

Physical EPCQ: EPCQ32ASI8N

 

I am following the example from Intel, the "Remote System Upgrade over UART Based on Nios® II Processor with EPCQ"

 

I wrote the following code to test it:

 

int i,image1_StartAddress, image1_EndAddress, image1_StartSector, image1_EndSector, eraseSector;

image1_StartAddress = 0x000000;

image1_EndAddress = 0x3BFFFF;

image1_StartSector = (image1_StartAddress & 0xFFFF0000) >> 16;

image1_EndSector = (image1_EndAddress & 0xFFFF0000) >> 16;

//int eraseSector;

IOWR(EPCQ_CONTROLLER2_0_AVL_CSR_BASE, 0x3, 0x00001703);

for(i=image1_StartSector; i<=image1_EndSector; i++)

{

eraseSector = (eraseSector & 0) | (i << 8) | 0x02;

printf("Erasing Application 1 Image sector %d\n", i);

IOWR(EPCQ_CONTROLLER2_0_AVL_CSR_BASE, 0x3, eraseSector);

}

 

for(int i=image1_StartAddress; i<6; i++)

{

IOWR_8DIRECT(EPCQ_CONTROLLER2_0_AVL_MEM_BASE, i,i);

printf("Writing %d from address %d\n", i,i);

}

 

// Read

for(int i=image1_StartAddress; i<6 i++)

{

int data=IORD_8DIRECT(EPCQ_CONTROLLER2_0_AVL_MEM_BASE, i);

printf("Reading %d from address %d\n", data,i);

}

 

After executing it, the write data missmatch the read data.

 

Any thoughts?

 

Thanks.

0 Kudos
0 Replies
Reply