cancel
Showing results for 
Search instead for 
Did you mean: 

FatFs cannot write file larger then 64kB

malarab
Senior II

Hi

i build an application with fatfs implementation to log data.

but when the file size reach 64kB, the SD card stop responding and i can not write on it.

I used standard configuration for ff_conf

any suggestion to resolve the problem ?

thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
malarab
Senior II

using the low level code from stm32wl FatFs example to interface FatFs drivers with my spi peripheral was not worked.

by trying the low level code from stm32f7 example it is work correctly

it was about the implementation of :

BSP_SD_ReadBlocks

BSP_SD_WriteBlocks

BSP_SD_Erase

.... and other functions

View solution in original post

3 REPLIES 3
AScha.3
Chief II

FatFs has > UINT btw, /* [IN] Number of bytes to write */

so limit is 4 GB .

If you feel a post has answered your question, please click "Accept as Solution".
malarab
Senior II

Hi AScha.3

UINT is an unsigned int so it can reach 4GB.

but in my application :

  1. when f_size(&SDFile) reach 36911
  2. if i call f_lseek to set file pointer to the start of new line in text file
  3. then when move_windows() is called to read fill sector window with new data
  4. the SPI interface dos not receive any data !

(see picture)

and i have a file of 37kB (65kB on disk)

i also tried with FA_OPEN_APPEND to remove f_lseek fuction, but i have also the same problem

0693W00000SwDoCQAV.png 

0693W00000SwDolQAF.png 

malarab
Senior II

using the low level code from stm32wl FatFs example to interface FatFs drivers with my spi peripheral was not worked.

by trying the low level code from stm32f7 example it is work correctly

it was about the implementation of :

BSP_SD_ReadBlocks

BSP_SD_WriteBlocks

BSP_SD_Erase

.... and other functions