We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi to all, i am referring www.siwawi.arubi.uni-kl.de/.../
i made some changes on the code and i got some results :).
my code from main.c is:
FATFS *fs;/* Pointer to file system object */ DWORD fre_clust, fre_sect, tot_sect; DRESULT Disk; FRESULT res1; IoInit(); //Timer, UART and LED initialize xputs("\nFatFs module test monitor for LPC2388"); w1 = f_mount(0,fs); // mounting logical drive 0 xprintf("\r\nmount status %d",w1); // res = disk_initialize(0); // physical drive 0. But i dont know why // xprintf("\r\n Return value of diak_initilize() is %d",res); Disk = disk_status(0); // status if physical drive 0 xprintf("\r\n Return value of diak_status() is %x",Disk); // Get drive information and free clusters res1 = f_getfree("/Test.txt", &fre_clust, &fs); if (res1) put_rc(res1); xprintf("\r\n Retuen value of getfree() is %d",res1); // xprintf("\r\n Free Clusters %ld",fre_clust); // Get total sectors and free sectors tot_sect = (fs->max_clust - 2) * fs->csize; fre_sect = fre_clust * fs->csize; // Print free space in unit of KB (assuming 512B/sector) xprintf("%\r\nlu KB total drive space.\n" "%lu KB available.\n", fre_sect / 2, tot_sect / 2); // Open source file res1 = f_open(&file1, "Test.txt", FA_OPEN_EXISTING | FA_READ); if (res1) { put_rc(res1); } xprintf("\r\n status Opening Test1 file %d",res1); // Create destination file res1 = f_open(&file2, "b.txt", FA_CREATE_ALWAYS | FA_WRITE); if (res1) { put_rc(res1); } xprintf("\r\n status of opening b file %d",res1); // Copy source to destination for (;;) { res1 = f_read(&file1, Buff, sizeof(Buff), &br); if (res1 || br == 0) { put_rc(res1); xprintf("\r\n Reading status %d",res1); break; // error or eof } xprintf("\r\n Read sta %d",w1); res1 = f_write(&file2, Buff, br, &bw); if (res1 || bw < br) { put_rc(res1); xprintf("\r\n write status %d",res1); break; // error or disk full } xprintf("\r\n Write Sta %d",w1); } // Close all files f_close(&file1); f_close(&file2); // Unregister a work area before discard it f_mount(0, NULL);
i give the result here.
FatFs module test monitor for LPC2388
mount status 0
Return value of diak_status() is MCI_INIT ok no timeout on CMD8 -> SD-Card>=Version 2.0 ACMD41 success -> SD-Card SC or HC SDSC detected MCI_Send_CSD result: 002f0032 5f5983bd edb7ff9f 964000a8 setting 4bit width success
rc=11 FR_NO_FILESYSTEM Retuen value of getfree() is 11MCI_INIT ok no timeout on CMD8 -> SD-Card>=Version 2.0 ACMD41 success -> SD-Card SC or HC SDSC detected MCI_Send_CSD result: 002f0032 5f5983bd edb7ff9f 964000a8 setting 4bit width success
rc=11 FR_NO_FILESYSTEM
status Opening Test1 file 11MCI_INIT ok no timeout on CMD8 -> SD-Card>=Version 2.0 ACMD41 success -> SD-Card SC or HC SDSC detected MCI_Send_CSD result: 002f0032 5f5983bd edb7ff9f 964000a8
i have formatted my SD card at FAT32 fs...
but here the same statement repeated three times. And even some data has been suppressed.
I dont know whats the MCI_Send_CSD result? What those values specifies?
Then i tried to fwrite a file and copy that file to another file. but i always failed. Y?
The way i am going on is correct or not? From Andy and per's lot of reply helped me to come to this level. But still i need more....
Again i tried to format it. But it says write protected. and failed to format it. Why? i didnt make it as write protected....