Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

cannot make file system on external flash with VFS

I have a Winbond 25Q64FV (which is a 64Mbit/8Mbyte chip) hooked up to an ESP32. I cloned the example-spi-c project, added https://github.com/mongoose-os-libs/file-logger, built it locally, and flashed.

I am using the standard SPI pinouts (MISO = 19, MOSI = 23, SCLK = 18, CS = 5), and the example-spi-c project is reporting a JEDEC ID of 'ef 40 17', which makes sense (2 ^ 0x17 = 8M).

I can't create file system:

mos call FS.Mkfs '{"dev_type": "spi_flash", "dev_opts": "{\"freq\": 40000000, \"cs\": 0}", "fs_type": "SPIFFS"}'
Using port /dev/ttyUSB0
Error: context deadline exceeded
/build/mos-2ibE_S/mos-2.8.1+0fc1db0~bionic0/obj-x86_64-linux-gnu/src/cesanta.com/common/go/mgrpc/mgrpc.go:434: 
/build/mos-2ibE_S/mos-2.8.1+0fc1db0~bionic0/obj-x86_64-linux-gnu/src/cesanta.com/mos/dev/dev_conn.go:222: 
/build/mos-2ibE_S/mos-2.8.1+0fc1db0~bionic0/obj-x86_64-linux-gnu/src/cesanta.com/mos/main.go:171: call failed

the log sez

mg_rpc_handle_reques FS.Mkfs via UART UART0
mgos_vfs_mkfs_dev    Create SPIFFS (dev 0x3ffbadc4, opts )
mgos_vfs_fs_spiffs_m addr 0x0 size 8388608 bs 4096 ps 256 es 4096 nfd 10 encr 0 => -10025

negative status codes don't seem like success....

I can make the timeout go away by specifying a smaller-than-full-chip size.

mos call FS.Mkfs '{"dev_type": "spi_flash", "dev_opts": "{\"freq\": 40000000, \"cs\": 0}", "fs_type": "SPIFFS", "fs_opts": "{\"size\": 1000000}"}'
Using port /dev/ttyUSB0
null

and it appears that it worked

mg_rpc_handle_reques FS.Mkfs via UART UART0
mgos_vfs_mkfs_dev    Create SPIFFS (dev 0x3ffbadfc, opts {"size": 1000000})
mgos_vfs_fs_spiffs_m There is a valid FS already, reformatting

but mounting fails:

mg_rpc_handle_reques FS.Mount via UART UART0
mgos_vfs_mount_dev   /mnt: SPIFFS @ , opts 
mgos_vfs_fs_spiffs_m addr 0x0 size 8388608 bs 4096 ps 256 es 4096 nfd 10 encr 0 => -10025
mgos_vfs_fs_spiffs_m SPIFFS mount failed
mgos_vfs_mount_dev   FS SPIFFS : mount failed

it appears that it is trying to mount it with a 8M size, even though I made it with a 1M fs size?

If I specify the same size on the mount that I did on the mkfs, it works:

mos call FS.Mount '{"dev_type": "spi_flash", "dev_opts": "{\"freq\": 40000000, \"cs\": 0}", "fs_type": "SPIFFS", "path": "/mnt", "fs_opts": "{\"size\": 1000000}"}'
mg_rpc_handle_reques FS.Mount via UART UART0
mgos_vfs_mount_dev   /mnt: SPIFFS @ , opts {"size": 1000000}
mgos_vfs_print_fs_in /mnt: size 911381, used: 0, free: 911381

so it looks like I have the chip working and understand my mkfs and mount, but I need to understand why MKFS is throwing a -10025 (#define SPIFFS_ERR_NOT_A_FS -10025) if I do not specify the file system size and want to use the entire chip?

Comments

  • I ended up switching to LFS (SPIFFS is horribly slow on large FS), and issues went away....

Sign In or Register to comment.