Hi Daniel,

The SmartFS FS *can* work with devices greater than 16M Bytes. I have used it with a 256MBit / 32M Byte SPI flash before quite successfully.

But you have to ensure the logical sector size is large enough. One limitation of the SMART MTD (and therefore SMART FS) implementation is that it uses unsigned 16-bit integers for logical sector numbers. This means you can only have 65536 maximum logical sectors (actually a few less than that, but the code knows how to deal with 65536 values and simply "waste" a few reserved values like zero and 0xFFFF).

This means that for a 32M byte flash, you would need to ensure the logical sector size is at least 32M / 65536 = 512 bytes. Typically for the SMART MTD layer, a logical sector size of 1024 or 2048 (or larger) is preferred because the code can manage erase blocks / free sector collection management better.

In your 'make menuconfig', check your SMART logical sector size and try setting it to 2048. For the W25256JEVIEQ part with 256-byte pages, this will be 8 pages per logical sector, which is a good setting. Of course this also means that the smallest file size is 2K bytes, even if the file only has 1 byte stored in it. That's the price you pay for a structured file system though.

Ken


On 10/19/22 4:39 PM, Daniel Pereira Carvalho wrote:
Hi guys,

I am trying to use the memory W25Q256JVEIQ, with SMARTS FS. To do it I
added the support for this memory in "drivers/mtd/w25.c". I just added the
code below
















*..#define W25_JEDEC_CAPACITY_256MBIT 0x19  /* 8192x4096 = 256Mbit memory
capacity */../* 256M-bit / 32M-byte (33,554,432) * * W25Q256JV (Standard
SPI) */else if (capacity == W25_JEDEC_CAPACITY_256MBIT)  {
priv->nsectors = NSECTORS_256MBIT;  }..*

The memory initialization seems to go well. I can run the mksmartfs
utility, mount and write to the filesystem. However when I reboot the board
I can't mount the filesystem again. The function smartfs_mount() returns
the error "ERROR: No low-level format found".

The documentation says that SMARTS FS is designed to work with 1M byte to
16M byte in size (though this is not a limitation). So I changed the
priv->nsectors from NSECTORS_256MBIT to NSECTORS_128MBIT to see if the
problem was with the size of the memory. After this change the file system
started to work as expected.

Should SMARTS FS work with memories larger than 16M, since in the docs it
is said that this is not a limitation? If SMART FS is limited to memories
smaller than 16M do you recommend another filesystem?

Thanks

Daniel Pereira de Carvalho


Reply via email to