Skip to main content
Visitor II
May 16, 2023
Question

Integrating LittleFS in stm32L1XX project

  • May 16, 2023
  • 2 replies
  • 4152 views

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!

    This topic has been closed for replies.

    2 replies

    Super User
    May 17, 2023

    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

    Explorer II
    August 16, 2024

    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.