Project

General

Profile

Spiffs Block

How this block appears in a Simulink model?

What can be configured?


Configuration Parameter Selectable Option/Value Description
Mode Read /Write /Append Select pin for CS
Format if mount fail True--False If FAT partition cannot be mounted, and this parameter is true, create partition table and format the filesystem.
Base path /spiffs The block registers given FAT drive in VFS, at specified base path.
File path /spiffs/filename.txt
Maximum number of files 05 maximum number of files which can be open at the same time
Allocation unit size Multiples of 1024 If ‘format_if_mount_failed’ is set, and mount fails, format the card with given allocation unit size. Must be a power of 2, between sector size and 128 * sector size. For SD cards, sector size is always 512 bytes.

When to use this block?

SPIFFS lets you access the flash memory like you would do in a normal filesystem in your computer, but simpler and more limited. You can read, write, close, and delete files. At the time of writing this post, SPIFFS doesn't support directories, so everything is saved on a flat structure.

How does this block work?

SPIFFS is a file system intended for SPI NOR flash devices on embedded targets. It supports wear levelling, file system consistency checks, and more.
  • Currently, SPIFFS does not support directories, it produces a flat structure. If SPIFFS is mounted under /spiffs, then creating a file with the path /spiffs/tmp/myfile.txt will create a file called /tmp/myfile.txt in SPIFFS, instead of myfile.txt in the directory /spiffs/tmp.
  • It is not a real-time stack. One write operation might take much longer than another.
  • For now, it does not detect or handle bad blocks.

For more info : https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spiffs.html

Demo

Spiffs demo

Previous : Wireless Communication Block (HIL)
Next : SD Card Read Block

Also available in: PDF HTML TXT