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??
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