This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

File handling with SPI flash device

Hello,

Can anyone suggest me how to do the file handling on the SPI Flash device having 2 Mb memory space. Work done by me till now

1.Added the relevent FS_SPI_FlashDev.h & FS_SPI_FlashPrg.c files into my project
2. Enabled the File_config.c file to the SPI flash mode
3. I was able to read/ write data (Some numbers for testing)
4.Opened the file in write mode & write data. Here is what i did:

void tst_flash (void) {

FILE *fc; U8 buf123; U8 ch;

char count =0; Chip_Erase();

fc = fopen ("test.txt","w");

if(fc == NULL) { Display =2; // Used for debugging } else { Display =3; // Display Showed 3 this means file is not empty fputc(0x0a,fc);

}

fclose(fc);

fc = fopen ("test.txt","r");

if(fc == NULL) { Display =4; // Display showed 4 which means that the file==NULL?

}

else { Display = 5 count =0; while (!feof (fc)) { ch = fgetc (fc); buf123 = ch; count++; }

fclose(fc);

}

if(buf123 == 00) { Display =6; } else { Display =7; }

}

Can anyone please help me out.

Regards,

Sonali S