7 years, 4 months ago.

LittleFS Mounting to DataFlash AT45DB321 problem

Hello Mbed community,

I am working on a STM32F103RB customized board and My goal is to create a File system like structure to access data from above mentioned Flash(AT45DB321). My choice is Mbed LittleFS.

I have intialized configuration as below:

const struct lfs_config cfg = { .read = usrread, .prog = usrwrite, .erase = usrerase, .sync = usrsync, block device configuration .read_size = 2, .prog_size = 2, .block_size = 4096, .block_count = 1024,assuming blocks as flash number of blocks .lookahead = 1024, }; My SPI interface is working fine and I have defined my own function calls for usrread(), usrwrite(), usrerase() and I am not clear with usrsync(). For this I am freeing read and write buffers and returning LFS_ERR_OK. int usrsync(const struct lfs_config *c) { lfs_free(c->read_buffer); lfs_free(c->prog_buffer);

return LFS_ERR_OK; }

After Mounting I am getting in terminal as "lfs debug:686: Bad block at u<LF>".

If any one has done this or LittleFS please suggest me,

Thank you all.

Be the first to answer this question.