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, i am working on a project that in it i need to write and read sectors in sd card, i decide to use keil File system lib with mci driver but i have problem to write sector in sd card but reading is ok. i use below code to initilize sd card:
if (finit ("M0:") != fsOK) { // Initialize File System return 0; // Exit if failed } id = fs_ioc_get_id ("M0:"); // Get ID of media drive if (sdcard_drv_id < 0U) { return 0; } // If ID is invalid exit status = 0U; if (fs_ioc_device_ctrl (id, fsDevCtrlCodeControlMedia, &status) != fsOK) { return 0; // Exit if failed } if (fs_ioc_lock (id)) { // Lock media for USB usage return 0; // Exit if failed } st = fs_ioc_write_sector(id,0,buf,1); if(st != fsOK) return 0;
when i call fs_ioc_write_sector in above code it returns FsError(0x01) but when reading sector it work correctly. can any one give me an advise to solve that??
hi mohamad, i am using keil middleware file system under CMSIS:MCI driver, and i did n't find file that you point, also my mcu is lpc1788. after i programming keil usb file system example to my board, i notice that this example like my code can not write sector on sd card and writing done with fsError !!!! may be problem is keil side and library has a problem ???? i am still searching for solution and i can find problem.
after some hours of Paddle i noticed that fs_write sector write data on sd card(i can see writed data on hex editor when atach it to computer) but it return FsError !!!!!!! i wondered so, what is problem??
I uploaded file system files from outside and used it separate as any other c file that is why i can control my programs more easy check FATFS by chan files and try to implement it outside keil lib
don macki, I suggest that you take a look at your MCI driver and investigate if COMMAND_TIMEOUT/ERROR or TRANSFER_TIMEOUT/ERROR events are returned at some point.