pellepl / spiffs

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

Problems with the example code #259

Open aprzgit opened 4 years ago

aprzgit commented 4 years ago

Hello everybody,

I have compiled the example code for "hello world". However the example project doesn't seem to work fine, when I read the contents of the file the string "Hello world" is corrupted, some letters are missing or are wrong, for example something like this appears: "Hel$o wod".

I have configured the parameters correctly: 64KB sector erase (from flash datasheet), start address 0x0 and a size of 4MB for file system (flash size is greater than 4MB), 64KB for logic sector and 256Bytes for logic page (the same Page size of the flash).

I have erased completely the flash and the mount function works fine and returns 0. I have tried to change some flags from config file, such as SPIFFS_CACHE or SPIFFS_USE_MAGIC but is still fails (with USE_MAGIC I have followed the instructions of wiki and it mounts fine but "hello world" is still corrupted).

It seems that the problem is when writing because if I start the program but I only mount the file system and read from the file (without writting anything) it returns the same wrong string ( then the file system is there but the content of the file is wrong).

When I change some options when compiling, as the stack size, the string I write and read from the file changes, but there still are characters that are missed or corrupted (a bad "Hello world" appears). I have checked the flash read/write functions separately and work fine... (I have tested the whole flash memory).

I have tried with other strings different to "Hello world" (with different lenghts and content) but the problem is still there.

I would be very grateful if anyone could help me as I am stuck in the first step... Has this issue ever happened to anyone?

Many thanks and kind regards