Open safirxps opened 5 years ago
In the first mount is normal have this error because lfs can't found the superblock. But, after lfs_format, this error should go away. When are you having this error?
Hi, Thanks it is working now. New problem after filewrite, I did the following :
filesystem_filewrite("TestPol1",&polo,sizeof(testva));
with :
int filesystem_filewrite(const char* filename, void *buffer, lfs_size_t size)
{
lfs_file_t Filesystem_Filetype;
int err = 0;
err=lfs_file_open(&Filesystem_Handle, &Filesystem_Filetype, filename, LFS_O_WRONLY | LFS_O_CREAT);
if(err == 0)
{
lfs_size_t WriteSize=lfs_file_write(&Filesystem_Handle, &Filesystem_Filetype, buffer, size);
err = WriteSize;
}
lfs_file_close(&Filesystem_Handle, &Filesystem_Filetype);
return err;
}
The result of filewrite is ok, with the size of the block, however when calling file open to read the size just after it can not find the file, I look at in Flash with debugger , and I can find file name I was using, what can be wrong ?
lfs_file_open(&Filesystem_Handle, &Filesystem_Filetype, "TestPol1", LFS_O_RDONLY)
return file name not existing.
Hello,
First of all, the size in lfs_file_write should be the size of data pointed by buffer. So, filesystem_filewrite("TestPol1",&polo,sizeof(polo))
should be better. The same for reading. Maybe this wrong call of write has corrupted the file, I don't know.
Hi @lsilvaalmeida , @safirxps even i am facing similar issues, i have declared prog, read, lookahead size as 256bytes, if i try to write more than 256 it is corrupting mounted filesystem. what might be the mistake? your earliest reply would help me a lot
Hi @safirxps, thanks for creating an issue.
Are there any errors returned by lfs_file_close
? The data usually not committed until lfs_file_close
. You can commit earlier (and check for errors) with lfs_file_sync
if you need to.
If there's no error, are you able to post a dump of the filesystem? I'm not sure what could be wrong.
Also what chip are you using? Does it support 4KiB erase blocks? I've seen a number of MCU internal flash require much larger erase blocks.
Hi I have resolved the issue.. in my case issue was with erase function which I was using was incorrect. It was reading more than expected area.. Thanks for your reply too. It would help in future
On Thu, Jul 18, 2019, 12:53 PM geniusgogo notifications@github.com wrote:
but i switch littlefs v1.7 no error。
[I/SF] SPI Flash JEDEC-ID Detection(ID:c84017) [I/SF] SPI Flash Capacity:(8MB) [I/INIT] File System initialized! msh />
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ARMmbed/littlefs/issues/206?email_source=notifications&email_token=AMDC2CCDGSF4JCQLRP452JTQAAK5ZA5CNFSM4HYIPNUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2HSK5Q#issuecomment-512697718, or mute the thread https://github.com/notifications/unsubscribe-auth/AMDC2CGNL6JAE4H26GGPVGLQAAK5ZANCNFSM4HYIPNUA .
I got strange error at the begining of my software my code is as follow :
using latest Littlefs version
my config is :