Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No more space left with W25Q16 #1034

Open
simon88 opened this issue Oct 24, 2024 · 0 comments
Open

No more space left with W25Q16 #1034

simon88 opened this issue Oct 24, 2024 · 0 comments

Comments

@simon88
Copy link

simon88 commented Oct 24, 2024

Hi,
I'm tring to use w25q16 chip with little fs. I use this library for STM v1.20.0
So everything works with SPI I can find the chip etc. I've implemented lfs like this

#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 = LFS_BUFFER_SIZE,
        .prog_size = LFS_BUFFER_SIZE,
        .block_size = 65536,
        .block_count = 32,
        .cache_size = LFS_BUFFER_SIZE,
        .lookahead_size = 128,
        .block_cycles = 500,

        .read_buffer = read_buffer,
        .prog_buffer = prog_buffer,
        .lookahead_buffer = lookahead_buffer
};

....

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;
}

I'm able to format the chip and mount. But as soon as I try to create a file (size 757 bytes) I got lfs.c:691:error: No more free space 0x18

What I'm doing wrong? I've also try to change block_size and block_count to 4096 and 32, but with this conf, I'm not able to format and mount I got error -28 for formating part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant