04-19-2010 10:58 AM - edited 04-19-2010 11:07 AM
The two main resources on this subject I have found are ug333 and xapp1034. I have written a test program on a custom board and am not able to read and write the in system flash. I am using a spartan 3 an 700.
I initialize spi followed by the isf and get the appropriate instance pointers. I then create the read parameter and write parameter structs. When I read and write to the same location I do not get the correct value read back and I am not sure if I am even writing to the in system flash. I am not sure how to find out if the error is in initialization, reading or writing. Could someone offer some guidance on how to debug this?
The following is a little bit of the code I am using (full code attached). Is this the correct method for reading and writing to in system flash?
u8* buf = malloc(sizeof(u8));
XIsf_WriteParam *wp = malloc(sizeof(XIsf_WriteParam));
XIsf_ReadParam *rp = malloc(sizeof(XIsf_ReadParam));
Status = XIsf_Initialize(&isf, &spi, ISF_SPI_SELECT, temp);
wp->Address = XPAR_XPS_INSYSTEM_FLASH_0_BASEADDR + 0xA1C00; //first available user data space
wp->WritePtr = buf;
wp->NumBytes = 1;
rp->Address = XPAR_XPS_INSYSTEM_FLASH_0_BASEADDR + 0xA1C00;
rp->ReadPtr = buf;
rp->NumBytes = 1;
*buf = 66;
Status = XIsf_Write(&isf, XISF_WRITE, wp);
*buf = 0;
Status = XIsf_Read(&isf, XISF_READ, rp);
//*buf should now equal 66 but does not
05-03-2010 09:35 AM
I don't necessarily need a solution if no one knows but could someone comment on whether I am doing something obviously wrong or not? I am stuck at this point.
Going to take another look at those documents..
07-20-2010 11:07 AM
I came across this post while looking for info on xilisf. Did you ever get this worked out? I'm able to read and write to my flash ok, but it seems to me that the xilisf functions are dealing with addresses totally wrong... but of course, I could be wrong as well. Have you (or anybody else) been successful with this?