element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Dev Tools
  • Products
  • More
Dev Tools
Forum How to write files in littlefs filesystem SPI External flash ?
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Dev Tools to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 3 replies
  • Subscribers 75 subscribers
  • Views 1808 views
  • Users 0 members are here
  • development_tools
  • littlefs
  • spi
  • programming
  • flash
  • tools
  • filesystem
Related

How to write files in littlefs filesystem SPI External flash ?

parthsanepara
parthsanepara over 1 year ago

Hi,

I would like to know some techniques or any readily available tools or modules available in the market. to write for ex. .txt, .mp3 files in my external used with my Host MCU via SPI Flash (Winbond). For flash file management I am using littlefs file system. I can able to access the filesystem within MCU access. but I want to write some large files with host PC before mounting flash on the PCB.

Thanks,

Parth

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 1 year ago +1
    Hi, There are many ways to skin this. One approach if your PC is a Raspberry Pi (since it has a user-accessible SPI interface) would be to build the littlefs code for the Pi, and let it program the chip…
  • dougw
    dougw over 1 year ago +1
    Here is a specific example which might provide some insight.... https://www.youtube.com/watch?v=nEqSCR3gb_0
  • shabaz
    shabaz over 1 year ago

    Hi,

    There are many ways to skin this. One approach if your PC is a Raspberry Pi (since it has a user-accessible SPI interface) would be to build the littlefs code for the Pi, and let it program the chip. In other words, write an application for the Pi that can write what you need to the Flash.

    Another approach would be to build on a normal PC (desktop or laptop), but transport the SPI commands, from the PC to an external device (e.g. via USB) to translate them back. It may require custom hardware, although there are some USB to SPI devices and ICs out there.

    Yet another approach would be to emulate SPI flash on the PC (you'd need to write that code) using a malloc'd area of memory, so that once the custom littlefs based PC application has written to the emulated flash, then you can dump to a binary file (or other format) and use a standard off-the-shelf USB programmer tool (e.g. 'J-Flash SPI' - I've never tried it) for writing to the external real Flash. There are dozens of similar off-the-shelf products, could even be DIY'd.

    Another approach, that would not require building littlefs on a PC, would be to use a standard programmer to read the SPI flash contents from your working product, and then write it out to as many Flash devices as you require. I've never tried this, so I have no idea if it would work (I don't know littlefs in enough detail to know if it makes use of any unique ID).
    But worth a try since you wouldn't need any custom software, just an off-the-shelf programmer to read and write.

    If that works, there may be existing products (or would be straightforward to build your own custom device) that acts like a standalone storage and programming device (sometimes known as a 'fill gun'). That way, once you've uploaded the Flash contents to it, it is standalone, connect it to your board, and press a single button to program the Flash.

    If your target Flash will not be on a PCB, then you'll also need a socket for the SMD flash (usually known as a SMD ZIF socket). And if you do need to buy that, then it's not worth buying the cheap sliding socket; get the black socket with the large lever, they are (can be) very reliable.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 1 year ago

    Here is a specific example which might provide some insight....
    https://www.youtube.com/watch?v=nEqSCR3gb_0

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • parthsanepara
    parthsanepara over 1 year ago

    Thanks, shabaz dougw 

    I found a solution in Zephyr RTOS, which has a module for writing files to external or internal memory with Littlefs or other file systems.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube