2012-02-08 4:06 PM
Hi Chaps,
Going slowly mad trying to get Chan Fat working with the sdio libs on a stm32f4.I'm using the most recent (1.0.0) library for the F4, and the low level access demo within that library builds and (at least appears to ) work OK. I've spent many, many hours attempting to patch in 0.9 version of fatfs from chan (thks chan, you're a hero) - but I can't get it to work.If possible, I'd really really appreciate a demo project/source (or direction to - though I've scoured the web and can't find anything that works!)I'll post separately about the current problems I'm having with the my current build, but a working example would sort it.Many thanks,nat. #hse-sdio-stm32 #stm32-fat-chanfat-fatfs-sdio #sdcard-stm32f4-sdio-fatfs #sdcard-stm32f4-sdio-fatfs2016-09-19 1:52 PM
If I closed a file and then reopen it, I cannot write more data to it after reopening it, but if i keep it open i can write as many lines as i want then close it after i am finished writing. Does anyone have a similar issue withe ELM Chang's FATFS?
See the example below. Thanks. if (f_mount(&FatFs, '''', 1) == FR_OK) { f_mkdir (''TEST''); count = 0; while(count < 200){ if(f_open(&fil, ''TEST/test.txt'', FA_OPEN_ALWAYS | FA_WRITE) != FR_OK){ break; } else{ sprintf(array,''This is file entry number: %d '',count); f_puts(array, &fil); if(f_close(&fil) != FR_OK){ break; } } count++; } f_mount(0, '''', 1); }http://stackoverflow.com/questions/39560704/elm-changs-fatfs#
If I close a file and then reopen it, I cannot write more data to it after reopening it, but if i keep it open i can write as many lines as i want then close it when i am finish writing. See the example below. Thanks.
if (f_mount(&FatFs, '''', 1) == FR_OK) { f_mkdir (''TEST''); count = 0; while(count < 200){ if(f_open(&fil, ''TEST/test.txt'', FA_OPEN_ALWAYS | FA_WRITE) != FR_OK){ break; } else{ sprintf(array,''This is file entry number: %d
'',count); f_puts(array, &fil); if(f_close(&fil) != FR_OK){ break; } } count++; } f_mount(0, '''', 1);}
2016-09-19 2:03 PM
@clive
If I close a file and then reopen it, I cannot write more data to it after reopening it. Does anyone have this problem? if I execute the following code it will not save all the lines, it will save only the last line of data. if (f_mount(&FatFs, '''', 1) == FR_OK) { f_mkdir (''TEST''); count = 0; while(count < 200){ if(f_open(&fil, ''TEST/test.txt'', FA_OPEN_ALWAYS | FA_WRITE) != FR_OK){ break; } else{ sprintf(array,''This is file entry number: %d\r\n'',count); f_puts(array, &fil); if(f_close(&fil) != FR_OK){ break; } } count++; } f_mount(0, '''', 1);}2016-09-19 4:08 PM - edited 2024-05-06 12:07 PM
Posted on September 20, 2016 at 01:08, cleaned up messy forum transition 6-May-2023
Seek to the end of the file
...
// Incremental write test, appending to end-of-file
if (f_open(&fil, "LOG.TXT", FA_OPEN_ALWAYS | FA_WRITE) == FR_OK)
{
UINT BytesWritten;
const char string[] = "Another line gets added";
f_lseek(&fil, fil.fsize); // newer perhaps f_size(&fil) macro?
f_write(&fil, string, strlen(string), &BytesWritten);
f_close(&fil);
}
2017-10-23 5:08 AM
Hi,
Can you tell me how do you measure the writing speed to ur sd card???
Thanks & Regards
Sameena Shaikh
2024-05-06 11:54 AM
BYPASS is problematic on the F2/F4 implementations. ST want's you to use at least a DIV2 of the clock. However you can clock the SDIO peripheral from a 75 MHz PLL clock getting you 37.5 MHz on the bus. Problem then is that USB and CRYP don't work as wrong speed, and too fast.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.