pellepl / spiffs

Wear-leveled SPI flash file system for embedded devices
MIT License
1.52k stars 402 forks source link

SPIFFS read after write is not correct #255

Open saperlot opened 4 years ago

saperlot commented 4 years ago

Hi, If i take the example from the wiki (create file / write "hello world" / close / open / read) it works. if i remove the steps close and open, basically create / write / read, data which i read is wrong. Is there an issue with my cache or is this not what i should do?

My cache buffers are these: static u8_t spiffs_work_buf[QSPI_PAGE_SIZE*2]; static u8_t spiffs_fds[sizeof(spiffs_fd) * SPIFFS_MAX_OPEN_FILES]; static u8_t spiffs_cache_buf[(QSPI_PAGE_SIZE+32)*4];

pellepl commented 4 years ago

Did you flush before read?

Den fre 10 jan. 2020 09:05saperlot notifications@github.com skrev:

Hi, If i take the example from the wiki (create file / write "hello world" / close / open / read) it works. if i remove the steps close and open, basically create / write / read, data which i read is wrong. Is there an issue with my cache or is this not what i should do?

My cache buffers are these: static u8_t spiffs_work_buf[QSPI_PAGE_SIZE2]; static u8_t spiffs_fds[sizeof(spiffs_fd) SPIFFS_MAX_OPEN_FILES]; static u8_t spiffs_cache_buf[(QSPI_PAGE_SIZE+32)*4];

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pellepl/spiffs/issues/255?email_source=notifications&email_token=ABG42V5IQ7F27UJ6WELFPF3Q5AT4DA5CNFSM4KFD6GFKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IFIWNSA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG42V7ZRPYNG2PNRB4GFQLQ5AT4DANCNFSM4KFD6GFA .

MMI commented 4 years ago

Wouldn't you need to seek back to the beginning of the data before the read?