cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating LittleFS in stm32L1XX project

JBamb.1
Associate

Hello,

Because there are negative side effects of using FatFS in my program to write logs to an SD Card, I am trying LittleFS library with an implementation of the HAL library.

When I mount the filesystem &lfs I get a result of -84 which indicates that the fielsystem is corrupt. I made sure I tested and formatted the sd card.

I believe that my implementation of the device block operations is not complete. see attachment.

extern const struct lfs_config cfg = {

   // Block device operations

   .read = user_provided_block_device_read,

   .prog = user_provided_block_device_prog,

   .erase = user_provided_block_device_erase,

   .sync = user_provided_block_device_sync,

   // Block device configuration

   .read_size = 16,

   .prog_size = 16,

   .block_size = 4096,

   .block_count = 128,

   .cache_size = 16,

   .lookahead_size = 16,

   .block_cycles = 500,

};

Help will be greatly appreciated!

2 REPLIES 2

What is LittleFS?

I also don't think this is the right place to discuss it, you may want to try to contact its authors.

JW

hans86
Associate III

Hi JBamb,

It might be a bit late but in case somebody else is having an issue with Littlefs and finds this post I have uploaded 2 simple examples of using Littlefs with SPI and QSPI here:

https://github.com/htminuslab/STM32-LittleFS-SPI
https://github.com/htminuslab/STM32-LittleFS-QSPI

This is for a STM32H743 using HAL calls so should be relative easy to port to another STM32 family,

Hope this helps,
Hans.