AnsweredAssumed Answered

files disappear and reappear with fss fat32 on SDHC

Question asked by jeanmichel on Jan 19, 2011
Latest reply on Jan 26, 2011 by jeanmichel



I'm using Visual DSP++ Update 8 with an ADSP-BF518F EZ-BOARD.

I want to access an SD HC card (4GB) (FAT32) to read and write files.

I am using directly functions from adi_fss (like adi_fss_FileOpen).


In the main code I write a file then I read it.

I never have any problem to write the file. But to read it, I need first to write into it. And if I restart the board with a new program without the file writing part , it does not find the file.


Even better, I put some files on the card with my computer. Then I start the program on the board (and then I write the file bb on the card). If I put the board again in the computer (windows xp) it just find the file bb (the other files disappeared). Then I copy one file with the computer on the card and I eject the card from the computer. I plug again the card in the computer and then all files reappeared .... I tried to reformat it does not help.


Any clue ?


Thanks a lot.


Jena Michel LECONTE



Main Code
int main( void )
int n;
// init services
u32 Result=InitServices();
ADI_FSS_WCHAR name[50];
char ledvalue=0;
if ( !Result ) {
        /* Initialize the file system */
        Result = InitFileSystem();
        do {  
            u32 Result = ADI_FSS_RESULT_SUCCESS;
            ADI_FSS_FILE_HANDLE fh;
          /* write file bb */
          /* close it */
           /* read file bb */
   if (Result==ADI_FSS_RESULT_SUCCESS) {
int n;
printf("File opened ! \n");
while (n<200000000)
u32 sizeread,i;
//     i=fread(bufferread,sizeof(char),(1024) ,fp);
printf("end of file !");
printf("another error! ");
/* close file */
if (Result!=ADI_FSS_RESULT_SUCCESS) printf("Cannot close file !\n");
else {
printf("Unable to read file \n");
/* Begin adding your custom code here */
return 0;







ADI_FSS_CMD_VALUE_PAIR adi_fss_Config[] = {     

/* Set up File Cache Size */         { ADI_FSS_CMD_SET_NUMBER_CACHE_BLOCKS,  (void*)2 },       

/* Set up Heap Index of the FSS General Heap */        { ADI_FSS_CMD_SET_GENERAL_HEAP_ID,      (void*)GeneralHeapID },

/* Register the SDH interface driver */         { ADI_FSS_CMD_ADD_DRIVER,               (void*)&ADI_SDH_Def },       

/* Register the FAT File System driver */         { ADI_FSS_CMD_ADD_DRIVER,               (void*)&ADI_FAT_Def },       

/* Assign the DMA Manager Handle */         { ADI_FSS_CMD_SET_DMA_MGR_HANDLE,       (void*)adi_dma_ManagerHandle },       

/* Assign the Device Manager Handle */         { ADI_FSS_CMD_SET_DEV_MGR_HANDLE,       (void*)adi_dev_ManagerHandle },       

/* Assign the DCB Queue Handle */         { ADI_FSS_CMD_SET_DCB_MGR_HANDLE,       (void*)adi_dcb_QueueHandle },       

/* Command Table Terminator */         { ADI_FSS_CMD_END,

(void*)NULL }     };




init services

#define ADI_SSL_INT_NUM_SECONDARY_HANDLERS  (10) // number of secondary interrupt handlers

#define ADI_SSL_DCB_NUM_SERVERS             (1) // number of DCB servers

#define ADI_SSL_DMA_NUM_CHANNELS            (4) // number of DMA channels

#define ADI_SSL_FLAG_NUM_CALLBACKS          (0) // number of flag callbacks

#define ADI_SSL_SEM_NUM_SEMAPHORES          (40) // number of semaphores

#define ADI_SSL_DEV_NUM_DEVICES             (4) // number of device drivers