Skip to content

high revision count, config.block_cycles 25000 on AT25SF321B of endurance 100,000 program and erase cycles #1163

@ChocolateCookie1000

Description

@ChocolateCookie1000

Hello,
I need clarification on the block_cycles parameter. Question 1) Is it supposed to be near the endurance of the flash chip? On the AT25SF321B-SHB-T, the data sheet says 100,00 program and erase cycles on page1.
https://www.renesas.com/en/document/dst/at25sf321b-datasheet?r=1608806

I put this for my config

#define FLASH_SIZE (4 * 1024 * 1024)
cfg.read_size = 256; 
cfg.prog_size = 256;  
cfg.cache_size = 256;  
cfg.block_size = 4096; 
cfg.block_count = FLASH_SIZE / cfg.block_size;
cfg.block_cycles = 25000;
cfg.lookahead_size = 16;  

I rewrite a file of 10 bytes every 6 minutes to the file system. I made a memory dump of the first few bytes and get
95 F8 0C 00 (little endian revision count) F0 0F FF F7 6C 69 74 74 6C 65 66 73(littlefs)
The revision count is 850,069. In the memory dump, most of the 4096 byte blocks of the flash are unused with FF. It is not distributing the wear on the chip.
Question 2) Is it correct to say that the dump says that the embedded system have really done 850,069 erases? I estimate it should have done file writes more in the order of 10,000.
Question 3) How do I choose a good value for cfg.block_cycles?

I remade the code on a PC with the PC's RAM and put cfg.block_cycles =500 and kept the cfg.prog_size = 256 . I put no delay of 10 minutes and tried for quantities of writes in the millions. I put in the callback of the erase an increment to an array to keep track of the quantity of erases per block number. On the PC, I get good spreading.

Question 5) If cfg.block_cycles is not the absolute max quantity of erase cycles on the block, how does littlefs know when to never erase a block of memory again?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions