spif
spif copied to clipboard
Trying to use littlefs with v1.20.0
Hi, I'm trying to use your librairy version 1.20.0 (old version) with little fs and w25q16 chip, but I'm stuck when I'm trying to format the chip. I'm able to detect the flash
w25qxx Init Begin...
w25qxx ID:0xEF4015
w25qxx Chip: w25q16
w25qxx Page Size: 256 Bytes
w25qxx Page Count: 8192
w25qxx Sector Size: 4096 Bytes
w25qxx Sector Count: 512
w25qxx Block Size: 65536 Bytes
w25qxx Block Count: 32
w25qxx Capacity: 2048 KiloBytes
w25qxx Init Done
here is my lfs configuration
#define LFS_BUFFER_SIZE 256
static uint8_t read_buffer[LFS_BUFFER_SIZE];
static uint8_t prog_buffer[LFS_BUFFER_SIZE];
static uint8_t lookahead_buffer[128];
struct lfs_config cfg_lfs = {
.read = lfs_read,
.prog = lfs_prog,
.erase = lfs_erase,
.sync = lfs_sync,
.read_size = 256,
.prog_size = 256,
.block_size = 4096,
.block_count = 32,
.cache_size = 256,
.lookahead_size = 128,
.block_cycles = 500,
.read_buffer = read_buffer,
.prog_buffer = prog_buffer,
.lookahead_buffer = lookahead_buffer
};
And wrapper
int lfs_sync(const struct lfs_config *c) {
return 0;
}
int lfs_erase(const struct lfs_config *c, lfs_block_t block) {
W25qxx_EraseBlock(&handler_spi, block * c->block_size);
return 0;
}
int lfs_prog(const struct lfs_config *c, lfs_block_t block, lfs_off_t offset, const void *buffer, lfs_size_t size) {
W25qxx_WritePage(&handler_spi, (uint8_t*)buffer, block*c->block_size, offset, size);
return 0;
}
int lfs_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t offset, void *buffer, lfs_size_t size) {
W25qxx_ReadPage(&handler_spi, (uint8_t*)buffer, block*c->block_size, offset, size);
return 0;
}
my handler
w25qxx_peripheral handler_spi = {
.hspi = &hspi2, // Initialisation du périphérique SPI
.cs_gpio = GPIOB, // Port GPIOB pour le Chip Select
.cs_pin = GPIO_PIN_12
};
Have ever use littlefs or not ?
EDIT : after updating lfs_configwith
.block_size = 65536,
.block_count = 32,
I'm able to format but as soon as I try to create a file I got lfs error no more free space 0xb
Hi. unfortunately i have never used little fs. but why you did not try with new library