buka86
Newbie level 2
Hi,
Could somebody help me and tell me how to write data to large file using fatfs libraries.
At the beginning i'm creating always new, empty file. My next step
is to close that file. And then when I want to add some data to
that file I'm doing following things:
1. f_open(&file,"file.dat",FA_WRITE | FA_CREATE_ALWAYS);
2. f_lseek(&file,f_size(&file));
3. f_write(&file,(const void*)data_table,2048,&bw);
4. f_close(&file);
I'm using this sequence periodicaly and works fine, but sometimes happens strange things
and i've got errors from functions above. Could it be possible
that SD card doesn't work properly? These errors aren't regular,
they occur 'sometimes'. Maybe it is connected with bad sectors on SD card.
I just wanna add that I'm using Atmega128 with 8MHz internal clock.
Regards
Could somebody help me and tell me how to write data to large file using fatfs libraries.
At the beginning i'm creating always new, empty file. My next step
is to close that file. And then when I want to add some data to
that file I'm doing following things:
1. f_open(&file,"file.dat",FA_WRITE | FA_CREATE_ALWAYS);
2. f_lseek(&file,f_size(&file));
3. f_write(&file,(const void*)data_table,2048,&bw);
4. f_close(&file);
I'm using this sequence periodicaly and works fine, but sometimes happens strange things
and i've got errors from functions above. Could it be possible
that SD card doesn't work properly? These errors aren't regular,
they occur 'sometimes'. Maybe it is connected with bad sectors on SD card.
I just wanna add that I'm using Atmega128 with 8MHz internal clock.
Regards