Question
Fatfs write problem
Posted on May 21, 2015 at 17:59
Hello
I use STM3210e-eval.I want to implement Fatfs for the SDcard (using SDIO interface)Thats work !I can create a file or a directory, read a file, write in the file, delete file, rename file.the problem is that: when I want to write multiples line in the file. Just one line is written in the file then the system go in the infinite loop of Default_Handler !!to write multiples line, I tried this two methods (one using f_pritnf and the other using f_write):1) ''in a loop''res = f_mount(0, &Fatfs);res = f_open(&Filsd, ''0:LOG.TXT'', FA_WRITE | FA_OPEN_ALWAYS);f_printf(&FilSD, ''ABCD\n'');f_close(&Filsd);f_mount(0, NULL);2) '' in a loop''writeTextBuff[]= ''ABCD\n''res = f_mount(0, &Fatfs);res = f_open(&Filsd, ''0:LOG.TXT'', FA_WRITE | FA_OPEN_ALWAYS);res = f_lseek(&Filsd, f_size(&Filsd));bytesToWrite =sizeof(writeTextBuff) - 1;res = f_write(&Filsd,writeTextBuff,bytesToWrite, &bytesWritten );f_close(&Filsd);f_mount(0, NULL);this first time, the code is executed normally, but the second loop the system go in Default_Handler at f_printf in method 1. and at f_lseek in method 2Any Help please ?Thank you #stm32 #dma #fatfs #sdio #sd